Module: Elementor::NodeSet
- Included in:
- ElementSet
- Defined in:
- lib/elementor/element_set.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
Delegates non-ElementSet methods to the NodeSet
27
28
29
30
31
32
33
|
# File 'lib/elementor/element_set.rb', line 27
def method_missing(sym, *args, &block)
if @node_set.respond_to?(sym)
@node_set.send(sym, *args, &block)
else
super
end
end
|
Class Method Details
.included(base) ⇒ Object
4
5
6
7
8
|
# File 'lib/elementor/element_set.rb', line 4
def self.included(base)
base.class_eval do
attr_accessor :node_set
end
end
|
Instance Method Details
#initialize(document, array) ⇒ Object
10
11
12
|
# File 'lib/elementor/element_set.rb', line 10
def initialize(document, array)
@node_set = Nokogiri::XML::NodeSet.new(document, array)
end
|
#replace(array) ⇒ Object
18
19
20
|
# File 'lib/elementor/element_set.rb', line 18
def replace(array)
@node_set = Nokogiri::XML::NodeSet.new(@node_set.document, array)
end
|
#respond_to?(sym) ⇒ Boolean
22
23
24
|
# File 'lib/elementor/element_set.rb', line 22
def respond_to?(sym)
super || @node_set.respond_to?(sym)
end
|
#select(&block) ⇒ Object
14
15
16
|
# File 'lib/elementor/element_set.rb', line 14
def select(&block)
@node_set.select &block
end
|