Class: Applitools::Base::Point
- Inherits:
-
Object
- Object
- Applitools::Base::Point
- Defined in:
- lib/applitools/base/point.rb
Constant Summary collapse
- TOP_LEFT =
Point.new(0, 0)
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(x, y) ⇒ Point
constructor
A new instance of Point.
- #to_hash(options = {}) ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(x, y) ⇒ Point
Returns a new instance of Point.
8 9 10 11 |
# File 'lib/applitools/base/point.rb', line 8 def initialize(x, y) @x = x @y = y end |
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
3 4 5 |
# File 'lib/applitools/base/point.rb', line 3 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
3 4 5 |
# File 'lib/applitools/base/point.rb', line 3 def y @y end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
15 16 17 18 |
# File 'lib/applitools/base/point.rb', line 15 def ==(other) return super.==(other) unless other.is_a?(Point) @x == other.x && @y == other.y end |
#hash ⇒ Object
22 23 24 |
# File 'lib/applitools/base/point.rb', line 22 def hash @x.hash & @y.hash end |
#to_hash(options = {}) ⇒ Object
26 27 28 |
# File 'lib/applitools/base/point.rb', line 26 def to_hash( = {}) [:region] ? { left: left, top: top } : { x: x, y: y } end |
#values ⇒ Object
30 31 32 |
# File 'lib/applitools/base/point.rb', line 30 def values [x, y] end |