dynarex 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- 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
|