polyrex-objects 0.6.8 → 0.6.9

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/polyrex-objects.rb +8 -1
  2. metadata +1 -1
@@ -54,13 +54,20 @@ class PolyrexObjects
54
54
  classx << "class #{name.capitalize} < PolyrexObject"
55
55
  classx << "def initialize(node=nil, id='0')"
56
56
  classx << "super(node,id)"
57
+
58
+ classx << "a = node.xpath('summary/*',&:name)"
59
+ classx << "yaml_fields = a - (#{fields} + %w(format_mask))"
60
+ classx << "yaml_fields.each do |field|"
61
+ classx << %q(instance_eval "def #{field}; YAML.load(@node.element('summary/#{field}/text()')); end")
62
+ classx << "end"
63
+
57
64
  classx << "@create = PolyrexCreateObject.new('#{schema}', @@id)"
58
65
  classx << "end"
59
66
  fields.each do |field|
60
67
  classx << "def #{field}; @node.element('summary/#{field}/text()'); end"
61
68
  classx << "def #{field}=(text); @node.element('summary/#{field}').text = text; end"
62
69
  end
63
- classx << "end"
70
+ classx << "end"
64
71
 
65
72
  eval classx.join("\n")
66
73
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: polyrex-objects
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.8
5
+ version: 0.6.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Robertson