Class: Puppeteer::ElementHandle::Offset
- Inherits:
-
Object
- Object
- Puppeteer::ElementHandle::Offset
- Defined in:
- lib/puppeteer/element_handle/offset.rb
Overview
A class to represent (x, y)-offset coordinates
Instance Attribute Summary collapse
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x:, y:) ⇒ Offset
constructor
A new instance of Offset.
Constructor Details
#initialize(x:, y:) ⇒ Offset
Returns a new instance of Offset.
4 5 6 7 |
# File 'lib/puppeteer/element_handle/offset.rb', line 4 def initialize(x:, y:) @x = x @y = y end |
Instance Attribute Details
#x ⇒ Object (readonly)
Returns the value of attribute x.
26 27 28 |
# File 'lib/puppeteer/element_handle/offset.rb', line 26 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
26 27 28 |
# File 'lib/puppeteer/element_handle/offset.rb', line 26 def y @y end |
Class Method Details
.from(offset) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/puppeteer/element_handle/offset.rb', line 9 def self.from(offset) case offset when nil nil when Hash if offset[:x] && offset[:y] Offset.new(x: offset[:x], y: offset[:y]) else raise ArgumentError.new('offset parameter must have x, y coordinates') end when Offset offset else raise ArgumentError.new('Offset.from(Hash|Offset)') end end |