Class: Puppeteer::ElementHandle::BoxModel
- Inherits:
-
Object
- Object
- Puppeteer::ElementHandle::BoxModel
- Defined in:
- lib/puppeteer/element_handle/box_model.rb
Constant Summary collapse
- QUAD_ATTRIBUTE_NAMES =
%i(content padding border margin)
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(result_model) ⇒ BoxModel
constructor
A new instance of BoxModel.
Constructor Details
#initialize(result_model) ⇒ BoxModel
Returns a new instance of BoxModel.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/puppeteer/element_handle/box_model.rb', line 5 def initialize(result_model) QUAD_ATTRIBUTE_NAMES.each do |attr_name| quad = result_model[attr_name.to_s] instance_variable_set( :"@#{attr_name}", quad.each_slice(2).map { |x, y| Point.new(x: x, y: y) }, ) end @width = result_model['width'] @height = result_model['height'] end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
17 18 19 |
# File 'lib/puppeteer/element_handle/box_model.rb', line 17 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
17 18 19 |
# File 'lib/puppeteer/element_handle/box_model.rb', line 17 def width @width end |