polyrex-objects 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 938c943b17c79b6cce510fb7b3a1f3d91f3325e2
4
- data.tar.gz: 41c1271c95f4b366fe738dd9ad8f26ec9b13c8ee
3
+ metadata.gz: f8c939c9f895bbfc089dd86ad6b5635aa946a719
4
+ data.tar.gz: 5390b7bc9e4c3f0f60f2d66eb520c963bc9bac9f
5
5
  SHA512:
6
- metadata.gz: 11b2cadddffeef0a1a7ad1fa510b2e81fc4836908c1e1448a70119f449955d24f7e855885c7a761e5215ada38997a5e1ff8ea5474cc043c1b562994294ac74f4
7
- data.tar.gz: ca9ace6a2501f35eb57493f6d3ddd6322c538fba01052643876d38dc66b615342b42898c70ceb3f262facbb7f1f1d147cbb461f1784c70771b9d794b9088785e
6
+ metadata.gz: 05816a8b48a78e3fd8caac151728b1fa7dd3552bd6d89788a7424297c2c0c04e7c5a01b300ce2e1f0b4b438f1bb80d6fe09dfed1bc8732da41a6eccba5543594
7
+ data.tar.gz: 14bcb1161c32389004a45567c067a37f0b42756fc4053866d8d1ec190f898f8074305617a6457974b6950f1c6a792f2aa6c175775a1b5f54c0d35e301534248e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -14,7 +14,7 @@ class PolyrexObjects
14
14
 
15
15
  attr_reader :node, :id
16
16
 
17
- def initialize(node, id='0')
17
+ def initialize(node, id: '0')
18
18
  @@id = id
19
19
  @node = node
20
20
  @fields =[]
@@ -32,8 +32,9 @@ class PolyrexObjects
32
32
  self.records.length
33
33
  end
34
34
 
35
- def create(id=nil)
36
- id ||= @@id
35
+ def create(id: '0')
36
+ id ||=@@id
37
+
37
38
  id.succ!
38
39
  @create.id = id
39
40
 
@@ -130,10 +131,11 @@ EOF
130
131
  end
131
132
  end
132
133
 
133
- def initialize(schema, id='0', node=nil)
134
+ def initialize(schema, node=nil, id: '0')
134
135
 
135
136
  @node = node
136
137
  @@id = id
138
+
137
139
  @schema = schema
138
140
 
139
141
  if schema then
@@ -171,13 +173,13 @@ EOF
171
173
  @class_names[1..-1].each_with_index do |class_name, k|
172
174
  eval "#{class_name}.class_eval {
173
175
  def parent()
174
- #{@class_names[k]}.new(@node.parent.parent, @@id)
176
+ #{@class_names[k]}.new(@node.parent.parent, id: @@id)
175
177
  end
176
178
  }"
177
179
  end
178
180
 
179
181
  methodx = @class_names.map do |name|
180
- %Q(def #{name.downcase}(); #{name}.new(@node, @@id); end)
182
+ %Q(def #{name.downcase}(); #{name}.new(@node, id: @@id); end)
181
183
  end
182
184
 
183
185
  self.instance_eval(methodx.join("\n"))
@@ -202,9 +204,10 @@ EOF
202
204
 
203
205
  classx = []
204
206
  classx << "class #{name.capitalize} < PolyrexObject"
205
- classx << "def initialize(node=nil, id='0')"
207
+ classx << "def initialize(node=nil, id: '0')"
208
+ classx << " @id = id"
206
209
  classx << " node ||= Rexle.new('<#{name}><summary/><records/></#{name}>').root"
207
- classx << " super(node,id)"
210
+ classx << " super(node, id: id)"
208
211
 
209
212
  classx << " a = node.xpath('summary/*',&:name)"
210
213
  classx << " yaml_fields = a - (#{fields} + %w(format_mask))"
@@ -213,7 +216,7 @@ EOF
213
216
  classx << "end"
214
217
 
215
218
  classx << "@fields = %i(#{fields.join(' ')})"
216
- classx << "@create = PolyrexCreateObject.new('#{@schema}', @@id)"
219
+ classx << "@create = PolyrexCreateObject.new('#{@schema}', id: '#{@id}')"
217
220
  classx << "end"
218
221
 
219
222
  fields.each do |field|
@@ -247,7 +250,7 @@ EOF
247
250
  classes = {#{@class_names.map{|x| %Q(%s: %s) % [x[/[^:]+$/].downcase,x]}.join(',')} }
248
251
 
249
252
  objects = @node.xpath('records/*').map do |record|
250
- classes[record.name.to_sym].new(record, @@id)
253
+ classes[record.name.to_sym].new(record, id: '#{@@id}')
251
254
  end
252
255
 
253
256
  def objects.records=(node); @node = node; end
data.tar.gz.sig CHANGED
Binary file
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.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  C0ZUhP8IAGCVW8QD8AfZ/AgqUdh+zTRqKdhEyhXCjYyVXqNHnD02NbyGmQvgd9SD
32
32
  XfuuGzQ3E4Mh5w==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-07-19 00:00:00.000000000 Z
34
+ date: 2014-07-27 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: polyrex-createobject
metadata.gz.sig CHANGED
Binary file