view_models 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/helpers/collection.rb +6 -8
- metadata +3 -3
data/VERSION.yml
CHANGED
data/lib/helpers/collection.rb
CHANGED
@@ -4,6 +4,8 @@ module ViewModels
|
|
4
4
|
|
5
5
|
# Construct a view_model for a collection.
|
6
6
|
#
|
7
|
+
# TODO Think about moving it into view_model_for, or renaming it view_models_for.
|
8
|
+
#
|
7
9
|
def collection_view_model_for array_or_pagination, context = self
|
8
10
|
Collection.new array_or_pagination, context
|
9
11
|
end
|
@@ -16,16 +18,12 @@ module ViewModels
|
|
16
18
|
#
|
17
19
|
class Collection
|
18
20
|
|
21
|
+
# Delegate collection relevant methods to the collection.
|
19
22
|
#
|
20
|
-
|
21
|
-
methods_to_delegate = [Enumerable.instance_methods.map(&:to_sym),
|
22
|
-
:length, :size, :empty?, :each, :exit,
|
23
|
-
{ :to => :@collection }].flatten
|
24
|
-
self.delegate *methods_to_delegate
|
25
|
-
def select *args, &block # active_support fail?
|
26
|
-
@collection.select *args, &block
|
27
|
-
end
|
23
|
+
self.delegate *[Enumerable.instance_methods, :length, :size, :empty?, :each, :exit, { :to => :@collection }].flatten
|
28
24
|
|
25
|
+
#
|
26
|
+
#
|
29
27
|
def initialize collection, context
|
30
28
|
@collection, @context = collection, context
|
31
29
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 1.5.
|
8
|
+
- 5
|
9
|
+
version: 1.5.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Florian Hanke
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-03-
|
20
|
+
date: 2010-03-03 00:00:00 +01:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|