polyrex-objects 0.1.6 → 0.2.0

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/polyrex-objects.rb +15 -13
  2. metadata +2 -2
@@ -15,20 +15,22 @@ class PolyrexObjects
15
15
 
16
16
  a.each do |x|
17
17
  name, raw_fields = x.split('[')
18
- fields = raw_fields.chop.split(',').map &:strip
19
- @class_names << name.capitalize
20
-
21
- classx = []
22
- classx << "class #{name.capitalize}"
23
- classx << "include REXML"
24
- classx << "def initialize(node); @node = node; end"
25
- fields.each do |field|
26
- classx << "def #{field}; XPath.first(@node, 'summary/#{field}/text()'); end"
27
- classx << "def #{field}=(text); XPath.first(@node, 'summary/#{field}').text = text; end"
18
+ if raw_fields then
19
+ fields = raw_fields.chop.split(',').map &:strip
20
+ @class_names << name.capitalize
21
+
22
+ classx = []
23
+ classx << "class #{name.capitalize}"
24
+ classx << "include REXML"
25
+ classx << "def initialize(node); @node = node; end"
26
+ fields.each do |field|
27
+ classx << "def #{field}; XPath.first(@node, 'summary/#{field}/text()'); end"
28
+ classx << "def #{field}=(text); XPath.first(@node, 'summary/#{field}').text = text; end"
29
+ end
30
+ classx << "end"
31
+
32
+ eval classx.join("\n")
28
33
  end
29
- classx << "end"
30
-
31
- eval classx.join("\n")
32
34
  end
33
35
 
34
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex-objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
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-30 00:00:00 +01:00
12
+ date: 2010-06-03 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15