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_grpc ⇒ Object
-
#to_h ⇒ Hash
Deeply converts object to a hash.
Instance Attribute Details
#max ⇒ Location
Returns the max lat/long pair.
725 726 727 |
# File 'lib/google/cloud/vision/image.rb', line 725 def max @max end |
#min ⇒ Location
Returns the min lat/long pair.
721 722 723 |
# File 'lib/google/cloud/vision/image.rb', line 721 def min @min end |
Instance Method Details
#empty? ⇒ Boolean
Returns true
if either min
or max
are not populated.
771 772 773 774 |
# File 'lib/google/cloud/vision/image.rb', line 771 def empty? min.to_h.values.reject(&:nil?).empty? || max.to_h.values.reject(&:nil?).empty? end |
#to_grpc ⇒ Object
785 786 787 788 789 790 791 |
# File 'lib/google/cloud/vision/image.rb', line 785 def to_grpc return nil if empty? Google::Cloud::Vision::V1::LatLongRect.new( min_lat_lng: min.to_grpc, max_lat_lng: max.to_grpc ) end |
#to_h ⇒ Hash
Deeply converts object to a hash. All keys will be symbolized.
781 782 783 |
# File 'lib/google/cloud/vision/image.rb', line 781 def to_h { min_lat_lng: min.to_h, max_lat_lng: max.to_h } end |