dynarex 1.1.37 → 1.1.38

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.rb +6 -6
  2. metadata +2 -2
@@ -31,7 +31,6 @@ class Dynarex
31
31
  @delimiter = ' '
32
32
  open(location) if location
33
33
  @dirty_flag = false
34
-
35
34
  end
36
35
 
37
36
  def add(x)
@@ -255,7 +254,7 @@ EOF
255
254
  item[:body].each do |name,value|
256
255
  #name = name.to_s.prepend('._').to_sym if reserved_keywords.include? name
257
256
  name = ('._' + name.to_s).to_sym if reserved_keywords.include? name
258
- xml.send name, value.to_s
257
+ xml.send(name, value.send(value.is_a?(String) ? :to_s : :to_yaml))
259
258
  end
260
259
  end
261
260
  end
@@ -407,6 +406,7 @@ EOF
407
406
  a_summary = raw_summary.split(',').map(&:strip)
408
407
 
409
408
  @summary = {}
409
+
410
410
  while raw_lines.first[/#{a_summary.join('|')}:\s+\w+/] do
411
411
  label, val = raw_lines.shift.match(/(\w+):\s+([^$]+)$/).captures
412
412
  @summary[label] = val
@@ -421,7 +421,7 @@ EOF
421
421
 
422
422
  yaml = YAML.load raw_lines.join("\n")
423
423
 
424
- yamlize = lambda {|x| (x.is_a? Array) ? '--- ' + x.to_s : x}
424
+ yamlize = lambda {|x| (x.is_a? Array) ? x.to_yaml : x}
425
425
 
426
426
  yprocs = {
427
427
  Hash: lambda {|y|
@@ -435,6 +435,7 @@ EOF
435
435
  }
436
436
 
437
437
  lines = yprocs[yaml.class.to_s.to_sym].call yaml
438
+
438
439
  else
439
440
 
440
441
  lines = raw_lines.map do |x|
@@ -446,8 +447,7 @@ EOF
446
447
 
447
448
  a = lines.map do|x|
448
449
  created = Time.now.to_s
449
-
450
- h = Hash[@fields.zip(x.map{|t| t.to_s[/^--- /] ? YAML.load(t) : t})]
450
+ h = Hash[@fields.zip(x.map{|t| t.to_s[/^---/] ? YAML.load(t) : t})]
451
451
  [h[@default_key], {id: '', created: created, last_modified: '', body: h}]
452
452
  end
453
453
 
@@ -608,4 +608,4 @@ EOF
608
608
  end
609
609
  end
610
610
 
611
- end
611
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dynarex
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.37
5
+ version: 1.1.38
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Robertson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-07-28 00:00:00 Z
13
+ date: 2012-07-29 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rexle