mad_id 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +6 -0
- data/Rakefile +6 -0
- data/lib/mad_id/version.rb +1 -1
- data/lib/mad_id.rb +6 -1
- data/spec/mad_id_spec.rb +5 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 316bc10f1801f7f68016bca9bc097d9c26ebbca4
|
4
|
+
data.tar.gz: 1a127701a912eb9c26f49a75fe96aefefee7df83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 235c69abe9a22cb8dc20d4a6b9b99dd075c6a299f0726463b65512f588c8925abc933807c70f302d478f2b2f285661aa59024528376e33728c579b66c9fb1502
|
7
|
+
data.tar.gz: 790415281b773ea475013e5f51289cc215e28d8971616f0e2527f9b19879efe5ad77a24fd1220d447e7c9e020f616b901386e01ec49196fd35dad0f961ff1584
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -46,6 +46,12 @@ If your not using Rails you'll have to include `MadId` on your own
|
|
46
46
|
identify_with :baz
|
47
47
|
end
|
48
48
|
|
49
|
+
### Registry
|
50
|
+
|
51
|
+
You can access all registered identifiers and the associated class via MadID's registry
|
52
|
+
|
53
|
+
MadID.registry
|
54
|
+
# => { 'foo' => YourModel }
|
49
55
|
|
50
56
|
## Contributing
|
51
57
|
|
data/Rakefile
CHANGED
data/lib/mad_id/version.rb
CHANGED
data/lib/mad_id.rb
CHANGED
@@ -10,11 +10,16 @@ require "mad_id/railtie" if defined?(Rails)
|
|
10
10
|
module MadID
|
11
11
|
extend ActiveSupport::Concern
|
12
12
|
|
13
|
+
@registry = {}
|
14
|
+
class << self
|
15
|
+
attr_accessor :registry
|
16
|
+
end
|
17
|
+
|
13
18
|
included do
|
14
19
|
def self.identify_with(value)
|
15
20
|
@identifier = value
|
21
|
+
MadID.registry[value.to_s] = self
|
16
22
|
self.send(:include, MadID::IdentityMethods)
|
17
23
|
end
|
18
24
|
end
|
19
|
-
|
20
25
|
end
|
data/spec/mad_id_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mad_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lars Brillert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -116,6 +116,7 @@ extensions: []
|
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
118
|
- .gitignore
|
119
|
+
- .travis.yml
|
119
120
|
- Gemfile
|
120
121
|
- LICENSE.txt
|
121
122
|
- README.md
|