rexle 0.4.1 → 0.4.2

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.
Files changed (2) hide show
  1. data/lib/rexle.rb +14 -6
  2. 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
- procs = {
13
- String: proc {|x| RexleParser.new(x).to_a},
14
- Array: proc {|x| x}
15
- REXML::Document: proc {|x| scan_doc x.root}
16
- }
17
- a = procs[x.class.to_s.to_sym].call(x)
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
 
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.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors: []
7
7