Class: Google::Cloud::Vision::Location
- Inherits:
-
Object
- Object
- Google::Cloud::Vision::Location
- Defined in:
- lib/google/cloud/vision/location.rb
Overview
# Location
A latitude/longitude pair with values conforming to the [WGS84 standard](www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf).
Instance Attribute Summary collapse
-
#latitude ⇒ Float
The degrees latitude conforming to the [WGS84 standard](www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf).
-
#longitude ⇒ Float
The degrees longitude conforming to the [WGS84 standard](www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf).
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(latitude, longitude) ⇒ Location
constructor
A new instance of Location.
- #inspect ⇒ Object
-
#to_a ⇒ Array
Returns the object’s property values as an array.
- #to_grpc ⇒ Object
-
#to_h ⇒ Hash
Converts object to a hash.
- #to_s ⇒ Object
Constructor Details
#initialize(latitude, longitude) ⇒ Location
Returns a new instance of Location.
48 49 50 51 |
# File 'lib/google/cloud/vision/location.rb', line 48 def initialize latitude, longitude @latitude = latitude @longitude = longitude end |
Instance Attribute Details
#latitude ⇒ Float
The degrees latitude conforming to the [WGS84 standard](www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf).
43 44 45 |
# File 'lib/google/cloud/vision/location.rb', line 43 def latitude @latitude end |
#longitude ⇒ Float
The degrees longitude conforming to the [WGS84 standard](www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf).
43 44 45 |
# File 'lib/google/cloud/vision/location.rb', line 43 def longitude @longitude end |
Class Method Details
.from_grpc(grpc) ⇒ Object
92 93 94 |
# File 'lib/google/cloud/vision/location.rb', line 92 def self.from_grpc grpc new grpc.latitude, grpc.longitude end |
Instance Method Details
#inspect ⇒ Object
77 78 79 |
# File 'lib/google/cloud/vision/location.rb', line 77 def inspect "#<#{self.class.name} #{self}>" end |
#to_a ⇒ Array
Returns the object’s property values as an array.
58 59 60 |
# File 'lib/google/cloud/vision/location.rb', line 58 def to_a [latitude, longitude] end |
#to_grpc ⇒ Object
83 84 85 86 87 88 |
# File 'lib/google/cloud/vision/location.rb', line 83 def to_grpc Google::Type::LatLng.new( latitude: latitude, longitude: longitude ) end |
#to_h ⇒ Hash
Converts object to a hash. All keys will be symbolized.
67 68 69 |
# File 'lib/google/cloud/vision/location.rb', line 67 def to_h { latitude: latitude, longitude: longitude } end |
#to_s ⇒ Object
72 73 74 |
# File 'lib/google/cloud/vision/location.rb', line 72 def to_s "(latitude: #{latitude.inspect}, longitude: #{longitude.inspect})" end |