Class: Puppeteer::ElementHandle::Point
- Inherits:
-
Object
- Object
- Puppeteer::ElementHandle::Point
- Defined in:
- lib/puppeteer/element_handle/point.rb
Overview
A class to represent (x, y)-coordinates supporting + and / operators.
Instance Attribute Summary collapse
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #/(num) ⇒ Object
-
#initialize(x:, y:) ⇒ Point
constructor
A new instance of Point.
Constructor Details
#initialize(x:, y:) ⇒ Point
Returns a new instance of Point.
5 6 7 8 |
# File 'lib/puppeteer/element_handle/point.rb', line 5 def initialize(x:, y:) @x = x @y = y end |
Instance Attribute Details
#x ⇒ Object (readonly)
Returns the value of attribute x.
24 25 26 |
# File 'lib/puppeteer/element_handle/point.rb', line 24 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
24 25 26 |
# File 'lib/puppeteer/element_handle/point.rb', line 24 def y @y end |
Instance Method Details
#+(other) ⇒ Object
[View source]
10 11 12 13 14 15 |
# File 'lib/puppeteer/element_handle/point.rb', line 10 def +(other) Point.new( x: @x + other.x, y: @y + other.y, ) end |
#/(num) ⇒ Object
[View source]
17 18 19 20 21 22 |
# File 'lib/puppeteer/element_handle/point.rb', line 17 def /(num) Point.new( x: @x / num, y: @y / num, ) end |