record_collection 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/record_collection/base.rb +3 -2
- data/lib/record_collection/version.rb +1 -1
- data/lib/record_collection.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f4c9e834f83c68f653fb61a5e6cc6d64de93b9d
|
4
|
+
data.tar.gz: 63b955eabed631e5d677fd1208f30385a3ab9db5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 611ccedfb1c6ed704e081fc8fcdb449373cdb0455f906a3cadd467f32c46bc27c3d9fb1397783d2e8c3670442d6e73d537970cb872d15a815d6a8ea11274d964
|
7
|
+
data.tar.gz: 5281731609ff8f44033a093715599bc19769d84069aa5633f627c2c19de7bcbe8c937f111937e88263a5df655279883876856a187fce3cc0384f0c990f97f71b
|
@@ -2,7 +2,6 @@ module RecordCollection
|
|
2
2
|
class Base
|
3
3
|
include Enumerable
|
4
4
|
include ActiveAttr::Model
|
5
|
-
STRING_IDS_SEPARATOR = '~'
|
6
5
|
|
7
6
|
attr_reader :collection
|
8
7
|
delegate :first, :last, :size, :length, :count, :empty?, :any?, to: :collection
|
@@ -57,7 +56,7 @@ module RecordCollection
|
|
57
56
|
def find(ids)
|
58
57
|
raise "Cannot call find on a collection object if there is no record_class defined" unless respond_to?(:record_class) && record_class
|
59
58
|
collection = case ids.presence
|
60
|
-
when String then record_class.find(ids.split(
|
59
|
+
when String then record_class.find(ids.split(RecordCollection.ids_separator))
|
61
60
|
when nil then []
|
62
61
|
else record_class.find(Array.wrap(ids))
|
63
62
|
end
|
@@ -104,6 +103,7 @@ module RecordCollection
|
|
104
103
|
before_blk = self.class.before_record_update
|
105
104
|
each do |record|
|
106
105
|
if before_blk
|
106
|
+
#before_blk = before_blk.to_proc unless before_blk.is_a?(Proc) # Allow symbol to proc without cumbersome notation
|
107
107
|
if before_blk.arity.zero?
|
108
108
|
record.instance_eval(&before_blk)
|
109
109
|
else
|
@@ -112,6 +112,7 @@ module RecordCollection
|
|
112
112
|
end
|
113
113
|
record.update changed_attributes
|
114
114
|
if after_blk
|
115
|
+
#after_blk = after_blk.to_proc unless after_blk.is_a?(Proc) # Allow symbol to proc without cumbersome notation
|
115
116
|
if after_blk.arity.zero?
|
116
117
|
record.instance_eval(&after_blk)
|
117
118
|
else
|
data/lib/record_collection.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: record_collection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin ter Kuile
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -513,7 +513,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
513
513
|
version: '0'
|
514
514
|
requirements: []
|
515
515
|
rubyforge_project:
|
516
|
-
rubygems_version: 2.4.
|
516
|
+
rubygems_version: 2.4.5
|
517
517
|
signing_key:
|
518
518
|
specification_version: 4
|
519
519
|
summary: Manage collections of records in Ruby on Rails
|