mad_id 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mad_id/finder_methods.rb +7 -0
- data/lib/mad_id/identity_methods.rb +2 -3
- data/lib/mad_id/railtie.rb +3 -2
- data/lib/mad_id/version.rb +2 -2
- data/lib/mad_id.rb +3 -3
- data/mad_id.gemspec +1 -1
- data/spec/mad_id_spec.rb +2 -2
- 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: e038f46a789e5a30b76cf12d219cfbdedeeb71b9
|
4
|
+
data.tar.gz: 00a03911be26277c043dd5b0f047ff0761709597
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66467e61f2ee40b9417f5fbb52eba6a0399264743fa7634f191f37ab24aaa713305006df56250a8ebd3e1b180166215120cc2112160a25d598ddddb5c7bf288c
|
7
|
+
data.tar.gz: 8ba763c6dcce3290bcbdfd02cfa63735740b711b87b58289432a787f67f67f762ede648c64ca44c9a4efe07e6f791f19f71043c63ffadd698a96892db0a842fc
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module MadID
|
2
2
|
|
3
3
|
module IdentityMethods
|
4
4
|
extend ActiveSupport::Concern
|
@@ -13,7 +13,7 @@ module MadId
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def set_identifier
|
16
|
-
self.identifier = "#{self.class.object_identifier_prefix}-#{SecureRandom.uuid}"[0..34]
|
16
|
+
self.identifier = "#{self.class.object_identifier_prefix}-#{SecureRandom.uuid}"[0..34].downcase
|
17
17
|
end
|
18
18
|
|
19
19
|
def short_identifier
|
@@ -23,7 +23,6 @@ module MadId
|
|
23
23
|
def to_param
|
24
24
|
self.identifier
|
25
25
|
end
|
26
|
-
|
27
26
|
end
|
28
27
|
|
29
28
|
end
|
data/lib/mad_id/railtie.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
module
|
1
|
+
module MadID
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
3
|
initializer 'mad_id.initialize' do |app|
|
4
4
|
ActiveSupport.on_load :active_record do
|
5
|
-
ActiveRecord::Base.send(:include,
|
5
|
+
ActiveRecord::Base.send(:include, MadID)
|
6
|
+
ActiveRecord::Base.extend( MadID::FinderMethods)
|
6
7
|
end
|
7
8
|
end
|
8
9
|
end
|
data/lib/mad_id/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.0
|
1
|
+
module MadID
|
2
|
+
VERSION = "0.1.0"
|
3
3
|
end
|
data/lib/mad_id.rb
CHANGED
@@ -4,16 +4,16 @@ require "active_record"
|
|
4
4
|
require "active_support"
|
5
5
|
|
6
6
|
require "mad_id/identity_methods"
|
7
|
+
require "mad_id/finder_methods"
|
7
8
|
require "mad_id/railtie" if defined?(Rails)
|
8
9
|
|
9
|
-
module
|
10
|
+
module MadID
|
10
11
|
extend ActiveSupport::Concern
|
11
12
|
|
12
13
|
included do
|
13
14
|
def self.identify_with(value)
|
14
15
|
@identifier = value
|
15
|
-
|
16
|
-
self.send(:include, MadId::IdentityMethods)
|
16
|
+
self.send(:include, MadID::IdentityMethods)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
data/mad_id.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'mad_id/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "mad_id"
|
8
|
-
spec.version =
|
8
|
+
spec.version = MadID::VERSION
|
9
9
|
spec.authors = ["Lars Brillert"]
|
10
10
|
spec.email = ["lars@railslove.com"]
|
11
11
|
spec.summary = %q{Adds prefixed identifiers to your models.}
|
data/spec/mad_id_spec.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
class Pony < ActiveRecord::Base
|
4
|
-
include
|
4
|
+
include MadID
|
5
5
|
end
|
6
6
|
|
7
7
|
class LittlePony < Pony
|
8
8
|
identify_with :pny
|
9
9
|
end
|
10
10
|
|
11
|
-
describe
|
11
|
+
describe MadID do
|
12
12
|
|
13
13
|
it 'inserts #identify_with' do
|
14
14
|
expect(Pony.respond_to?(:identify_with)).to be(true)
|
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.0
|
4
|
+
version: 0.1.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-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- README.md
|
122
122
|
- Rakefile
|
123
123
|
- lib/mad_id.rb
|
124
|
+
- lib/mad_id/finder_methods.rb
|
124
125
|
- lib/mad_id/identity_methods.rb
|
125
126
|
- lib/mad_id/locator.rb
|
126
127
|
- lib/mad_id/railtie.rb
|