dynarex-parser 0.1.7 → 0.1.8

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/dynarex-parser.rb +5 -26
  2. metadata +1 -1
@@ -1,32 +1,11 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- # file: dynarex_parser.rb
3
+ # file: dynarex-parser.rb
4
4
 
5
- require 'rexleparser'
6
-
7
- class DynarexParser
5
+ require 'recordx-parser'
8
6
 
7
+ class DynarexParser < RecordxParser
9
8
  def initialize(s)
10
-
11
- s.instance_eval{
12
- def fetch_node(name)
13
- self.slice(((self =~ /<#{name}>/) + name.length + 2) .. (self =~ /<\/#{name}>/) - 1)
14
- end
15
- }
16
-
17
- root_name = s[/<(\w+)/,1]
18
-
19
- summary = RexleParser.new("<summary>#{s.fetch_node(:summary)}</summary>").to_a
20
-
21
- raw_records = s.fetch_node(:records)
22
- node_name = raw_records[/<(\w+)/,1]
23
- records = raw_records.strip.split(/(?=<#{node_name}[^>]*>)/).map {|url| RexleParser.new(url).to_a}
24
-
25
- @a = [root_name, "", {}, [*summary], ['records', "",{}, *records]]
9
+ @a = super(s){|x| RexleParser.new(x).to_a}
26
10
  end
27
-
28
- def to_a()
29
- @a
30
- end
31
- end
32
-
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynarex-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors: []
7
7