polyrex-objects 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/polyrex-objects.rb +9 -0
- metadata +2 -2
data/lib/polyrex-objects.rb
CHANGED
@@ -49,6 +49,15 @@ class PolyrexObjects
|
|
49
49
|
def records()
|
50
50
|
XPath.match(@node, 'records/*').map {|record| #{@class_names[i]}.new(record)}
|
51
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
|
52
61
|
|
53
62
|
def create(id=nil)
|
54
63
|
@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.
|
4
|
+
version: 0.5.3
|
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-
|
12
|
+
date: 2010-06-10 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|