Module: MobyUtil::XML::Nokogiri::Nodeset
- Includes:
- Abstraction
- Defined in:
- lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb
Overview
Instance Method Summary
collapse
#name, #nil?, #to_s
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class MobyUtil::XML::Nokogiri::Abstraction
Instance Method Details
30
31
32
33
34
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 30
def []( node )
cache( :at_index, node ){ node_object( @xml[ node ] ) }
end
|
#collect(&block) ⇒ Object
85
86
87
88
89
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 85
def collect( &block )
_collect( &block )
end
|
#collect!(&block) ⇒ Object
91
92
93
94
95
96
97
98
99
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 91
def collect!( &block )
clear_cache
@xml = _collect( &block )
self
end
|
101
102
103
104
105
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 101
def compact
cache( :compact, :value ){ node_object( @xml.compact ) }
end
|
107
108
109
110
111
112
113
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 107
def compact!
@xml = cache( :compact_, :value ){ @xml.compact }
self
end
|
#delete(node) ⇒ Object
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 164
def delete( node )
clear_cache
@xml.each do | nodeset_node |
if ( node.xml.content == nodeset_node.content )
@xml.delete( nodeset_node )
break
end
end
end
|
#each(&block) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 48
def each( &block )
cache( :each, :cached_nodes ){
@xml.collect{ | node |
cache( :each, node ){ node_object( node ) }
}
}.each{ | node |
yield( node )
}
self
end
|
#each_with_index(&block) ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 73
def each_with_index( &block )
@xml.each_with_index{ | node, index |
yield( cache( :each, node ){ node_object( node ) }, index )
}
self
end
|
#empty? ⇒ Boolean
145
146
147
148
149
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 145
def empty?
cache( :empty?, :value ){ @xml.empty? }
end
|
36
37
38
39
40
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 36
def first
cache( :first, :value ){ node_object( @xml.first ) }
end
|
#inject(result, &block) ⇒ Object
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 115
def inject( result, &block )
cache( :each, :cached_nodes ){
@xml.collect{ | node |
cache( :each, node ){ node_object( node ) }
}
}.__send__( :inject, result, &block )
end
|
42
43
44
45
46
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 42
def last
cache( :last, :value ){ node_object( @xml.last ) }
end
|
#length ⇒ Object
Also known as:
size, count
151
152
153
154
155
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 151
def length
cache( :length, :value ){ @xml.length }
end
|
#sort(&block) ⇒ Object
129
130
131
132
133
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 129
def sort( &block )
node_object( _sort( &block ) )
end
|
#sort!(&block) ⇒ Object
135
136
137
138
139
140
141
142
143
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 135
def sort!( &block )
clear_cache
@xml = _sort( &block )
self
end
|
158
159
160
161
162
|
# File 'lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb', line 158
def to_a
cache( :to_a, :value ){ @xml.collect{ | node | node_object( node ) } }
end
|