polyrex-objects 0.6.11 → 0.6.12

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: d9bd0cbd4e12ff68fb5f96a2ae6225d3e4666f14
4
- data.tar.gz: 2cc4793e3d6dad990b7e4aa6812174eece5c7922
3
+ metadata.gz: 81562ece1dfc9ff78fad8cb7e996b4a7b7b38b86
4
+ data.tar.gz: dfab020cffa04dab9e486a85a896909d16bd5cc3
5
5
  SHA512:
6
- metadata.gz: 1a50815882b3197e438fd23724eb8e9cdd3e5b528129a80ad646225c7d80ce051fffb2691b285be8de5faf7a100a9c915e32f85f6f618d5bacba7ff44dbc5cc3
7
- data.tar.gz: ae308cea9af1d725332643998b2658b813c84b3f156d50fa7d3adacda82542dcfa9937809f9115175f6da52fc02911de41cbadadd6399c45354bf20c562a29b4
6
+ metadata.gz: 2eca8c04ce3d7228587e9cce471fc4a3e89c32d3e06b480b80621ad76859d40633c9882e4b6f8ad94a9bf166117f1eb2fafd7896f7e627834ec612cf8406e9e2
7
+ data.tar.gz: c5f49c8383860a306302f675af94225693b87515d8c60f949403a88633bc7d59fda44ed20b6e73c2ee22f31d735022d46c9569387136a1e5f26bca4806b592e9
checksums.yaml.gz.sig CHANGED
Binary file
@@ -25,6 +25,14 @@ class PolyrexObjects
25
25
  @create
26
26
  end
27
27
 
28
+ def delete()
29
+ @node.delete
30
+ end
31
+
32
+ def inspect()
33
+ "#<PolyrexObject:%s" % __id__
34
+ end
35
+
28
36
  def to_xml(options={})
29
37
  @node.xml(options)
30
38
  end
@@ -73,35 +81,16 @@ class PolyrexObjects
73
81
  end
74
82
  end
75
83
 
76
- # implement the child_object within each class object
77
- @class_names[0..-2].reverse.each_with_index do |class_name, k|
78
- i = @class_names.length - (k + 1)
79
- eval "#{class_name}.class_eval {
80
- def records()
81
- objects = @node.xpath('records/*').map {|record| #{@class_names[i]}.new(record, @@id)}
82
-
83
- def objects.records=(node); @node = node; end
84
- def objects.records(); @node; end
85
-
86
- def objects.sort_by!(&element_blk)
87
- a = @node.xpath('records/*').sort_by &element_blk
88
- records = @node.xpath('records')
89
- records.delete
90
- records = Rexle::Element.new 'records'
91
- a.each {|record| records.add record}
92
- @node.add records
93
- @node.xpath('records/*').map {|record| #{@class_names[i]}.new(record)}
94
- end
95
-
96
- objects.records = @node
97
- objects
98
- end
99
-
100
- alias #{@class_names[i].downcase} records
101
-
102
- }"
103
- end
104
-
84
+ if @class_names.length < 2 then
85
+ make_def_records(@class_names.first)
86
+ else
87
+ # implement the child_object within each class object
88
+ @class_names[0..-2].reverse.each_with_index do |class_name, k|
89
+
90
+ i = @class_names.length - (k + 1)
91
+ make_def_records(class_name,i)
92
+ end
93
+ end
105
94
  @class_names[1..-1].each_with_index do |class_name, k|
106
95
  eval "#{class_name}.class_eval {
107
96
  def parent()
@@ -118,6 +107,35 @@ class PolyrexObjects
118
107
  end
119
108
  end
120
109
 
110
+ def make_def_records(class_name, i=0)
111
+
112
+ eval "#{class_name}.class_eval {
113
+ def records()
114
+ objects = @node.xpath('records/*').map {|record| #{@class_names[i]}.new(record, @@id)}
115
+
116
+ def objects.records=(node); @node = node; end
117
+ def objects.records(); @node; end
118
+
119
+ def objects.sort_by!(&element_blk)
120
+ a = @node.xpath('records/*').sort_by &element_blk
121
+ records = @node.xpath('records')
122
+ records.delete
123
+ records = Rexle::Element.new 'records'
124
+ a.each {|record| records.add record}
125
+ @node.add records
126
+ @node.xpath('records/*').map {|record| #{@class_names[i]}.new(record)}
127
+ end
128
+
129
+ objects.records = @node
130
+ objects
131
+ end
132
+
133
+ alias #{@class_names[i].downcase} records
134
+
135
+ }"
136
+
137
+ end
138
+
121
139
  def to_a
122
140
  @class_names.map {|x| eval(x)}
123
141
  end
@@ -127,4 +145,4 @@ class PolyrexObjects
127
145
  end
128
146
 
129
147
 
130
- end
148
+ 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.6.11
4
+ version: 0.6.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -29,7 +29,7 @@ cert_chain:
29
29
  JMWS3MnEwxE/NLM3D1lV0gz1tVeyaJfaGg4M23ZLHbcE6P9LF2fV3LIRxDJlUeUB
30
30
  DdZHtSzrIZNGkcDlh1ea0JRmUxIv1wrk
31
31
  -----END CERTIFICATE-----
32
- date: 2013-07-27 00:00:00.000000000 Z
32
+ date: 2013-09-21 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: polyrex-createobject
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- �,�}+v�!e)~c���Ҝ�'_w�~��������)��~�o���tx��������wk2.8-�vܭ��l���Wam���b�z���f�����j�H�l���#
2
- �f�������gL�v炓�HPA�b�m(2}3��1�۩z���Z۩�W'�<B
1
+ A��]4P���6M�*KZ����I5“����C��˜��#�䩀B��p�=�?:عd