rexle 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rexle.rb +7 -8
- metadata +1 -1
data/lib/rexle.rb
CHANGED
@@ -9,9 +9,7 @@ include REXML
|
|
9
9
|
class Rexle
|
10
10
|
|
11
11
|
def initialize(x=nil)
|
12
|
-
|
13
|
-
a = []
|
14
|
-
|
12
|
+
|
15
13
|
if x then
|
16
14
|
procs = {
|
17
15
|
String: proc {|x| RexleParser.new(x).to_a},
|
@@ -19,11 +17,9 @@ class Rexle
|
|
19
17
|
:"REXML::Document" => proc {|x| scan_doc x.root}
|
20
18
|
}
|
21
19
|
a = procs[x.class.to_s.to_sym].call(x)
|
22
|
-
|
23
|
-
a = yield
|
20
|
+
@doc = scan_element(*a)
|
24
21
|
end
|
25
22
|
|
26
|
-
@doc = scan_element(*a)
|
27
23
|
end
|
28
24
|
|
29
25
|
def xpath(path)
|
@@ -182,8 +178,6 @@ class Rexle
|
|
182
178
|
end
|
183
179
|
end
|
184
180
|
|
185
|
-
|
186
|
-
|
187
181
|
def scan_match(nodes, element, attr_search, condition, rlist)
|
188
182
|
nodes.children.each.with_index do |x, i|
|
189
183
|
if x.name == element
|
@@ -223,6 +217,11 @@ class Rexle
|
|
223
217
|
|
224
218
|
end # -- end of element --
|
225
219
|
|
220
|
+
def parse()
|
221
|
+
a = yield
|
222
|
+
@doc = scan_element(*a)
|
223
|
+
end
|
224
|
+
|
226
225
|
def root() @doc end
|
227
226
|
def xml()
|
228
227
|
body = scan_print(self.root.children).join
|