rexle 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rexle.rb +16 -2
  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
- a = yield
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors: []
7
7