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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e038f46a789e5a30b76cf12d219cfbdedeeb71b9
4
- data.tar.gz: 00a03911be26277c043dd5b0f047ff0761709597
3
+ metadata.gz: 316bc10f1801f7f68016bca9bc097d9c26ebbca4
4
+ data.tar.gz: 1a127701a912eb9c26f49a75fe96aefefee7df83
5
5
  SHA512:
6
- metadata.gz: 66467e61f2ee40b9417f5fbb52eba6a0399264743fa7634f191f37ab24aaa713305006df56250a8ebd3e1b180166215120cc2112160a25d598ddddb5c7bf288c
7
- data.tar.gz: 8ba763c6dcce3290bcbdfd02cfa63735740b711b87b58289432a787f67f67f762ede648c64ca44c9a4efe07e6f791f19f71043c63ffadd698a96892db0a842fc
6
+ metadata.gz: 235c69abe9a22cb8dc20d4a6b9b99dd075c6a299f0726463b65512f588c8925abc933807c70f302d478f2b2f285661aa59024528376e33728c579b66c9fb1502
7
+ data.tar.gz: 790415281b773ea475013e5f51289cc215e28d8971616f0e2527f9b19879efe5ad77a24fd1220d447e7c9e020f616b901386e01ec49196fd35dad0f961ff1584
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.2
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
@@ -1 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
7
+
@@ -1,3 +1,3 @@
1
1
  module MadID
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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
@@ -65,6 +65,11 @@ describe MadID do
65
65
  end
66
66
  end
67
67
  end
68
+ end
68
69
 
70
+ describe 'Registry' do
71
+ it 'includes identifiable objects with stringified key' do
72
+ expect(MadID.registry).to include('pny' => LittlePony)
73
+ end
69
74
  end
70
75
  end
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.1.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-09-22 00:00:00.000000000 Z
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