dynarex 0.7.5 → 0.7.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/dynarex.rb +2 -1
- metadata +1 -1
data/lib/dynarex.rb
CHANGED
|
@@ -139,10 +139,11 @@ EOF
|
|
|
139
139
|
|
|
140
140
|
def create_from_line(line)
|
|
141
141
|
t = @format_mask.to_s.gsub(/\[!(\w+)\]/, '(.*)').sub(/\[/,'\[').sub(/\]/,'\]')
|
|
142
|
+
fields = @format_mask.to_s.scan(/\[!(\w+)\]/).flatten.map(&:to_sym)
|
|
142
143
|
line.match(/#{t}/).captures
|
|
143
144
|
|
|
144
145
|
a = line.match(/#{t}/).captures
|
|
145
|
-
h = Hash[
|
|
146
|
+
h = Hash[fields.zip(a)]
|
|
146
147
|
create h
|
|
147
148
|
self
|
|
148
149
|
end
|