is_a_collection 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/is_a_collection.rb +6 -4
- metadata +3 -3
data/lib/is_a_collection.rb
CHANGED
@@ -3,8 +3,8 @@ class Class
|
|
3
3
|
def is_a_collection(id_method=:id)
|
4
4
|
id_method = id_method.to_sym
|
5
5
|
|
6
|
-
include InstanceMethods
|
7
|
-
extend ClassMethods
|
6
|
+
include IsACollection::InstanceMethods
|
7
|
+
extend IsACollection::ClassMethods
|
8
8
|
|
9
9
|
define_method :add_to_collection do
|
10
10
|
self.class.__collection[__send__ id_method] = self
|
@@ -13,7 +13,9 @@ class Class
|
|
13
13
|
self.class.__collection.delete(__send__ id_method)
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
end
|
17
|
+
|
18
|
+
module IsACollection
|
17
19
|
module InstanceMethods
|
18
20
|
def initialize(*args, &block)
|
19
21
|
super
|
@@ -36,5 +38,5 @@ class Class
|
|
36
38
|
__collection[identifier]
|
37
39
|
end
|
38
40
|
end
|
39
|
-
|
40
41
|
end
|
42
|
+
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Niko Dittmann
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-12-
|
17
|
+
date: 2010-12-14 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|