Class: XPath::Union

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/xpath/union.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*expressions) ⇒ Union

Returns a new instance of Union.



10
11
12
# File 'lib/xpath/union.rb', line 10

def initialize(*expressions)
  @expressions = expressions
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object

rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing



22
23
24
# File 'lib/xpath/union.rb', line 22

def method_missing(*args) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
  XPath::Union.new(*arguments.map { |e| e.send(*args) })
end

Instance Attribute Details

#expressionsObject (readonly) Also known as: arguments

Returns the value of attribute expressions.



7
8
9
# File 'lib/xpath/union.rb', line 7

def expressions
  @expressions
end

Instance Method Details

#each(&block) ⇒ Object



18
19
20
# File 'lib/xpath/union.rb', line 18

def each(&block)
  arguments.each(&block)
end

#expressionObject



14
15
16
# File 'lib/xpath/union.rb', line 14

def expression
  :union
end

#to_xpath(type = nil) ⇒ Object Also known as: to_s



26
27
28
# File 'lib/xpath/union.rb', line 26

def to_xpath(type = nil)
  Renderer.render(self, type)
end