polyrex 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/polyrex.rb +6 -10
- metadata +1 -1
data/lib/polyrex.rb
CHANGED
@@ -21,11 +21,8 @@ class Polyrex
|
|
21
21
|
field_names = root_format_mask.to_s.scan(/\[!(\w+)\]/).flatten.map(&:to_sym)
|
22
22
|
@root_name = @recordx.shift
|
23
23
|
|
24
|
-
build_tree(a, new_a, 0, history)
|
25
|
-
out = scan_link(new_a)
|
26
|
-
|
27
24
|
summary = field_names.map {|x| "<%s/>" % x}.join
|
28
|
-
@doc = Document.new("<%s><summary>%s</summary></%s>" % [root_name, summary, root_name])
|
25
|
+
@doc = Document.new("<%s><summary>%s</summary></%s>" % [@root_name, summary, @root_name])
|
29
26
|
|
30
27
|
#----
|
31
28
|
|
@@ -124,15 +121,9 @@ end
|
|
124
121
|
history = []
|
125
122
|
history << new_a
|
126
123
|
|
127
|
-
root_format_mask = @format_masks.shift
|
128
|
-
field_names = root_format_mask.to_s.scan(/\[!(\w+)\]/).flatten.map(&:to_sym)
|
129
|
-
root_name = @recordx.shift
|
130
|
-
|
131
124
|
build_tree(a, new_a, 0, history)
|
132
125
|
out = scan_link(new_a)
|
133
126
|
|
134
|
-
summary = field_names.map {|x| "<%s/>" % x}.join
|
135
|
-
@doc = Document.new("<%s><summary>%s</summary></%s>" % [root_name, summary, root_name])
|
136
127
|
records = Document.new("<records>%s</records>" % out)
|
137
128
|
@doc.root.add records
|
138
129
|
end
|
@@ -178,10 +169,15 @@ end
|
|
178
169
|
tag_name = @recordx[i].to_s
|
179
170
|
|
180
171
|
line= x[0].reverse.map(&:strip).join
|
172
|
+
|
173
|
+
puts 'format_masks ' + @format_masks.inspect
|
181
174
|
@field_names = @format_masks[i].to_s.scan(/\[!(\w+)\]/).flatten.map(&:to_sym)
|
175
|
+
puts 'field_names : ' + @field_names.inspect
|
182
176
|
|
183
177
|
t = @format_masks[i].to_s.gsub(/\[!(\w+)\]/, '(.*)').sub(/\[/,'\[').sub(/\]/,'\]')
|
178
|
+
puts 'line : ' + line.inspect
|
184
179
|
field_values = line.match(/#{t}/).captures
|
180
|
+
puts 'field_values : ' + field_values.inspect
|
185
181
|
|
186
182
|
fields = @field_names.zip(field_values).map{|name, value| "<%s>%s</%s>" % [name,value,name]}.join
|
187
183
|
|