Class: Google::Cloud::Vision::Annotation::Vertex
- Inherits:
-
Object
- Object
- Google::Cloud::Vision::Annotation::Vertex
- Defined in:
- lib/google/cloud/vision/annotation/vertex.rb
Overview
Instance Attribute Summary collapse
-
#x ⇒ Integer
readonly
The X coordinate.
-
#y ⇒ Integer
readonly
The Y coordinate.
Class Method Summary collapse
-
.from_grpc(grpc) ⇒ Object
Client object.
Instance Method Summary collapse
-
#initialize(x, y) ⇒ Vertex
constructor
A new instance of Vertex.
- #inspect ⇒ Object
-
#to_a ⇒ Array
Returns the object’s property values as an array.
-
#to_h ⇒ Hash
Converts object to a hash.
- #to_s ⇒ Object
Constructor Details
#initialize(x, y) ⇒ Vertex
Returns a new instance of Vertex.
48 49 50 51 |
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 48 def initialize x, y @x = x @y = y end |
Instance Attribute Details
#x ⇒ Integer (readonly)
The X coordinate.
43 44 45 |
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 43 def x @x end |
#y ⇒ Integer (readonly)
The Y coordinate.
43 44 45 |
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 43 def y @y end |
Class Method Details
.from_grpc(grpc) ⇒ Object
Client object.
84 85 86 |
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 84 def self.from_grpc grpc new grpc.x, grpc.y end |
Instance Method Details
#inspect ⇒ Object
77 78 79 |
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 77 def inspect "#<Vertex #{self}>" end |
#to_a ⇒ Array
Returns the object’s property values as an array.
58 59 60 |
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 58 def to_a [x, y] end |
#to_h ⇒ Hash
Converts object to a hash. All keys will be symbolized.
67 68 69 |
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 67 def to_h { x: x, y: y } end |
#to_s ⇒ Object
72 73 74 |
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 72 def to_s "(x: #{x.inspect}, y: #{y.inspect})" end |