record_collection 0.9.0 → 0.9.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: 054699326645024b55cfe93751ecb9c85148acc0
4
- data.tar.gz: 9d33430ffa9434454764087df7fc213c48d649d1
3
+ metadata.gz: 7f4c9e834f83c68f653fb61a5e6cc6d64de93b9d
4
+ data.tar.gz: 63b955eabed631e5d677fd1208f30385a3ab9db5
5
5
  SHA512:
6
- metadata.gz: 0775171ff019a3c0b73c2dd600e22a90ca024fb258722cac298673001b4c1fb21ff933733f7f3b575c0580510db51ef14d123f210213863fd91fbff6c0f8adfa
7
- data.tar.gz: a063173c3f263b1ac375582dac5d31bf5e4837c13a220a5914b0828816082c8a8f6731eaeef738929808aa9af3064dddc8b10170d1ed1784e30ce7423a31a7d7
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(STRING_IDS_SEPARATOR))
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
@@ -1,3 +1,3 @@
1
1
  module RecordCollection
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -9,5 +9,5 @@ require 'record_collection/rails/form_helper'
9
9
  require 'record_collection/engine'
10
10
 
11
11
  module RecordCollection
12
- # Your code goes here...
12
+ mattr_accessor(:ids_separator){ '~' }
13
13
  end
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.0
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-03 00:00:00.000000000 Z
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.6
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