Class: DotDiff::ElementMeta::Rectangle
- Inherits:
-
Object
- Object
- DotDiff::ElementMeta::Rectangle
- Defined in:
- lib/dotdiff/element_meta.rb
Instance Attribute Summary collapse
-
#rect ⇒ Object
readonly
Returns the value of attribute rect.
Instance Method Summary collapse
-
#initialize(page, xpath) ⇒ Rectangle
constructor
A new instance of Rectangle.
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to_missing?(name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(page, xpath) ⇒ Rectangle
Returns a new instance of Rectangle.
19 20 21 |
# File 'lib/dotdiff/element_meta.rb', line 19 def initialize(page, xpath) @rect = get_rect(page, xpath) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dotdiff/element_meta.rb', line 23 def method_missing(name, *args, &block) if %w[x y width height].include?(name.to_s) case name when :x then rect['left'] when :y then rect['top'] else rect[name.to_s] end else super end end |
Instance Attribute Details
#rect ⇒ Object (readonly)
Returns the value of attribute rect.
17 18 19 |
# File 'lib/dotdiff/element_meta.rb', line 17 def rect @rect end |
Instance Method Details
#respond_to_missing?(name, _include_private = false) ⇒ Boolean
35 36 37 |
# File 'lib/dotdiff/element_meta.rb', line 35 def respond_to_missing?(name, _include_private = false) %w[x y width height].include?(name.to_s) || super end |