Class: Xpath::Specs::PagePart
- Inherits:
-
Object
- Object
- Xpath::Specs::PagePart
- Defined in:
- lib/xpath/specs/page_part.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#xpath ⇒ Object
readonly
Returns the value of attribute xpath.
Instance Method Summary collapse
- #has_parent ⇒ Object
-
#initialize(description, xpath, parent = nil) ⇒ PagePart
constructor
A new instance of PagePart.
- #long_description ⇒ Object
- #that(description, xpath) ⇒ Object
- #with(description, xpath) ⇒ Object
- #within_a(outer_page_part) ⇒ Object
Constructor Details
#initialize(description, xpath, parent = nil) ⇒ PagePart
Returns a new instance of PagePart.
7 8 9 10 11 |
# File 'lib/xpath/specs/page_part.rb', line 7 def initialize(description, xpath, parent = nil) @xpath = xpath @description = description @parent = parent end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
13 14 15 |
# File 'lib/xpath/specs/page_part.rb', line 13 def description @description end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
13 14 15 |
# File 'lib/xpath/specs/page_part.rb', line 13 def parent @parent end |
#xpath ⇒ Object (readonly)
Returns the value of attribute xpath.
13 14 15 |
# File 'lib/xpath/specs/page_part.rb', line 13 def xpath @xpath end |
Instance Method Details
#has_parent ⇒ Object
15 16 17 |
# File 'lib/xpath/specs/page_part.rb', line 15 def has_parent !parent.nil? end |
#long_description ⇒ Object
19 20 21 |
# File 'lib/xpath/specs/page_part.rb', line 19 def long_description "#{description} (#{xpath})" end |
#that(description, xpath) ⇒ Object
29 30 31 |
# File 'lib/xpath/specs/page_part.rb', line 29 def that(description, xpath) PagePart.new("#{self.description} that #{description}", self.xpath+xpath, self) end |
#with(description, xpath) ⇒ Object
23 24 25 |
# File 'lib/xpath/specs/page_part.rb', line 23 def with(description, xpath) PagePart.new(description, self.xpath+xpath, self) end |
#within_a(outer_page_part) ⇒ Object
26 27 28 |
# File 'lib/xpath/specs/page_part.rb', line 26 def within_a(outer_page_part) outer_page_part.with(self.description, self.xpath) end |