Class: Google::Cloud::Vision::Image::Context::Area
- Inherits:
-
Object
- Object
- Google::Cloud::Vision::Image::Context::Area
- Defined in:
- lib/google/cloud/vision/image.rb
Overview
Image::Context::Area
A Lat/long rectangle that specifies the location of the image.
Instance Attribute Summary collapse
-
#max ⇒ Location
Returns the max lat/long pair.
-
#min ⇒ Location
Returns the min lat/long pair.
Instance Method Summary collapse
-
#empty? ⇒ Boolean
Returns
true
if eithermin
ormax
are not populated. - #to_gapi ⇒ Object
-
#to_h ⇒ Hash
Deeply converts object to a hash.
Instance Attribute Details
#max ⇒ Location
Returns the max lat/long pair.
506 507 508 |
# File 'lib/google/cloud/vision/image.rb', line 506 def max @max end |
#min ⇒ Location
Returns the min lat/long pair.
502 503 504 |
# File 'lib/google/cloud/vision/image.rb', line 502 def min @min end |
Instance Method Details
#empty? ⇒ Boolean
Returns true
if either min
or max
are not populated.
552 553 554 555 |
# File 'lib/google/cloud/vision/image.rb', line 552 def empty? min.to_h.values.reject(&:nil?).empty? || max.to_h.values.reject(&:nil?).empty? end |
#to_gapi ⇒ Object
566 567 568 569 570 571 572 |
# File 'lib/google/cloud/vision/image.rb', line 566 def to_gapi return nil if empty? Google::Apis::VisionV1::LatLongRect.new( min_lat_lng: min.to_gapi, max_lat_lng: max.to_gapi ) end |
#to_h ⇒ Hash
Deeply converts object to a hash. All keys will be symbolized.
562 563 564 |
# File 'lib/google/cloud/vision/image.rb', line 562 def to_h { min_lat_lng: min.to_h, max_lat_lng: max.to_h } end |