dynarex 0.6.2 → 0.6.3

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/dynarex.rb +16 -0
  2. metadata +2 -2
@@ -117,6 +117,17 @@ EOF
117
117
 
118
118
  load_records
119
119
  end
120
+
121
+ def create_from_line(line)
122
+ format_mask = XPath.first(@doc.root, 'summary/format_mask/text()').to_s
123
+ t = format_mask.to_s.gsub(/\[!(\w+)\]/, '(.*)').sub(/\[/,'\[').sub(/\]/,'\]')
124
+ line.match(/#{t}/).captures
125
+
126
+ a = line.match(/#{t}/).captures
127
+ fields = format_mask.scan(/\[!(\w+)\]/).flatten.map(&:to_sym)
128
+ h = Hash[fields.zip(a)]
129
+ create h
130
+ end
120
131
 
121
132
  def update(id, params={})
122
133
  record_name, fields = capture_fields(params)
@@ -191,6 +202,11 @@ EOF
191
202
  end
192
203
  xml.records
193
204
  end
205
+
206
+ @default_key = fields[0]
207
+ @records = {}
208
+ @flat_records = {}
209
+
194
210
  buffer
195
211
  end
196
212
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynarex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors: []
7
7
 
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-13 00:00:00 +01:00
12
+ date: 2010-05-15 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15