rexle 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rexle.rb +16 -2
- metadata +1 -1
data/lib/rexle.rb
CHANGED
|
@@ -217,9 +217,23 @@ class Rexle
|
|
|
217
217
|
|
|
218
218
|
end # -- end of element --
|
|
219
219
|
|
|
220
|
-
def parse()
|
|
221
|
-
|
|
220
|
+
def parse(x)
|
|
221
|
+
|
|
222
|
+
a = []
|
|
223
|
+
|
|
224
|
+
if x then
|
|
225
|
+
procs = {
|
|
226
|
+
String: proc {|x| RexleParser.new(x).to_a},
|
|
227
|
+
Array: proc {|x| x},
|
|
228
|
+
:"REXML::Document" => proc {|x| scan_doc x.root}
|
|
229
|
+
}
|
|
230
|
+
a = procs[x.class.to_s.to_sym].call(x)
|
|
231
|
+
else
|
|
232
|
+
a = yield
|
|
233
|
+
end
|
|
234
|
+
|
|
222
235
|
@doc = scan_element(*a)
|
|
236
|
+
self
|
|
223
237
|
end
|
|
224
238
|
|
|
225
239
|
def root() @doc end
|