Class: Skia::IPoint
- Inherits:
-
Object
- Object
- Skia::IPoint
- Defined in:
- lib/skia/point.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(x = 0, y = 0) ⇒ IPoint
constructor
A new instance of IPoint.
- #to_a ⇒ Object
- #to_struct ⇒ Object
Constructor Details
#initialize(x = 0, y = 0) ⇒ IPoint
Returns a new instance of IPoint.
68 69 70 71 |
# File 'lib/skia/point.rb', line 68 def initialize(x = 0, y = 0) @x = x.to_i @y = y.to_i end |
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
66 67 68 |
# File 'lib/skia/point.rb', line 66 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
66 67 68 |
# File 'lib/skia/point.rb', line 66 def y @y end |
Class Method Details
.from_struct(struct) ⇒ Object
73 74 75 |
# File 'lib/skia/point.rb', line 73 def self.from_struct(struct) new(struct[:x], struct[:y]) end |
Instance Method Details
#==(other) ⇒ Object
84 85 86 87 88 |
# File 'lib/skia/point.rb', line 84 def ==(other) return false unless other.is_a?(IPoint) @x == other.x && @y == other.y end |
#to_a ⇒ Object
90 91 92 |
# File 'lib/skia/point.rb', line 90 def to_a [@x, @y] end |