Class: XPath::Union
Instance Attribute Summary collapse
-
#expressions ⇒ Object
readonly
Returns the value of attribute expressions.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(*expressions) ⇒ Union
constructor
A new instance of Union.
- #method_missing(*args) ⇒ Object
- #to_xpath(predicate = nil) ⇒ Object
- #to_xpaths ⇒ Object
Constructor Details
#initialize(*expressions) ⇒ Union
Returns a new instance of Union.
7 8 9 |
# File 'lib/xpath/union.rb', line 7 def initialize(*expressions) @expressions = expressions end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#expressions ⇒ Object (readonly)
Returns the value of attribute expressions.
5 6 7 |
# File 'lib/xpath/union.rb', line 5 def expressions @expressions end |
Instance Method Details
#each(&block) ⇒ Object
11 12 13 |
# File 'lib/xpath/union.rb', line 11 def each(&block) expressions.each(&block) end |
#to_xpath(predicate = nil) ⇒ Object
15 16 17 |
# File 'lib/xpath/union.rb', line 15 def to_xpath(predicate=nil) expressions.map { |e| e.to_xpath(predicate) }.join(' | ') end |
#to_xpaths ⇒ Object
19 20 21 |
# File 'lib/xpath/union.rb', line 19 def to_xpaths [to_xpath(:exact), to_xpath(:fuzzy)].uniq end |