polyrex-objects 0.5.3 → 0.6.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 +18 -11
  2. metadata +2 -2
@@ -47,17 +47,24 @@ class PolyrexObjects
47
47
  i = @class_names.length - (k + 1)
48
48
  eval "#{class_name}.class_eval {
49
49
  def records()
50
- XPath.match(@node, 'records/*').map {|record| #{@class_names[i]}.new(record)}
51
- end
52
-
53
- def sort_by!(&element_blk)
54
- a = XPath.match(@node, 'records/*').sort_by &element_blk
55
- records = XPath.first(@node, 'records')
56
- records.parent.delete records
57
- records = Element.new 'records'
58
- a.each {|record| records.add record}
59
- @node.add records
60
- end
50
+ objects = XPath.match(@node, 'records/*').map {|record| #{@class_names[i]}.new(record)}
51
+
52
+ def objects.records=(node); @node = node; end
53
+ def objects.records(); @node; end
54
+
55
+ def objects.sort_by!(&element_blk)
56
+ a = XPath.match(@node, 'records/*').sort_by &element_blk
57
+ records = XPath.first(@node, 'records')
58
+ records.parent.delete records
59
+ records = Element.new 'records'
60
+ a.each {|record| records.add record}
61
+ @node.add records
62
+ XPath.match(@node, 'records/*').map {|record| #{@class_names[i]}.new(record)}
63
+ end
64
+
65
+ objects.records = @node
66
+ objects
67
+ end
61
68
 
62
69
  def create(id=nil)
63
70
  @create.id = id || @id
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.5.3
4
+ version: 0.6.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-06-10 00:00:00 +01:00
12
+ date: 2010-06-11 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency