rexle 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rexle.rb +14 -6
- metadata +1 -1
data/lib/rexle.rb
CHANGED
@@ -9,12 +9,20 @@ include REXML
|
|
9
9
|
class Rexle
|
10
10
|
|
11
11
|
def initialize(x)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
|
13
|
+
a = []
|
14
|
+
|
15
|
+
if x then
|
16
|
+
procs = {
|
17
|
+
String: proc {|x| RexleParser.new(x).to_a},
|
18
|
+
Array: proc {|x| x}
|
19
|
+
REXML::Document: proc {|x| scan_doc x.root}
|
20
|
+
}
|
21
|
+
a = procs[x.class.to_s.to_sym].call(x)
|
22
|
+
else
|
23
|
+
a = yield
|
24
|
+
end
|
25
|
+
|
18
26
|
@doc = scan_element(*a)
|
19
27
|
end
|
20
28
|
|