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
Constructor Details
#initialize(page, xpath) ⇒ Rectangle
Returns a new instance of Rectangle.
17 18 19 |
# File 'lib/dotdiff/element_meta.rb', line 17 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
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dotdiff/element_meta.rb', line 21 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.
15 16 17 |
# File 'lib/dotdiff/element_meta.rb', line 15 def rect @rect end |