uuidable 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ad1b7916979bebfebcd5615eef3c664beebe157
4
- data.tar.gz: c929b5c8cb20d4f08a548a8ba5ff41795666eaa2
3
+ metadata.gz: 7243fffe7adb312c2dbf701e37b459c4e5d3cd12
4
+ data.tar.gz: 9925352679e6fba0c5a6df14497f72d47170a939
5
5
  SHA512:
6
- metadata.gz: e4f734306296b3593cd77609a8d81f5de720169fd5db5ad62a459f128849ac4c78c2cb63b42593e9b1344270ed7b5ff506b71d1218bd256f450b85d7a509b085
7
- data.tar.gz: 2fc41c7aee5bf8d608d53acad1c8e446fc5a01c898156daa7ac2493ecb7a72645549bc1a5756b1ee2a090be887159a7f04b267ca0b744501fb0446c5566a5542
6
+ metadata.gz: 28fe8675eee77c1d8b6ae4ca32603fe0a020533e0f3bf5cac68bf72e5b8a3e1d0447be37331d3d7d8569081e9c30e1d704417d2ef3b5ed698ce59d1c12087c81
7
+ data.tar.gz: 594ab432715ebbe4a4a9872550c967a4f476e3d0682eb11813ad835ab902b7f13aa12a52f9494b56213b1da49e49173f5e83eb0f4517955109f332c0a5ec56ae
@@ -9,3 +9,6 @@ Metrics/MethodLength:
9
9
 
10
10
  Metrics/AbcSize:
11
11
  Max: 25
12
+
13
+ Style/Documentation:
14
+ Enabled: False
@@ -5,8 +5,7 @@ module Uuidable
5
5
 
6
6
  class UuidChangeError < RuntimeError; end
7
7
 
8
- # ClassMethods
9
- module ClassMethods
8
+ module Finder
10
9
  def find(*args)
11
10
  if args.first && args.first.is_a?(String) && args.first.match(UUIDTools::UUID_REGEXP)
12
11
  find_by_uuid!(*args)
@@ -14,6 +13,11 @@ module Uuidable
14
13
  super
15
14
  end
16
15
  end
16
+ end
17
+
18
+ # ClassMethods
19
+ module ClassMethods
20
+ include Finder
17
21
 
18
22
  def uuidable(as_param: true)
19
23
  after_initialize { self.uuid = Uuidable.generate_uuid if attributes.keys.include?('uuid') && uuid.blank? }
@@ -41,4 +45,5 @@ end
41
45
 
42
46
  ActiveSupport.on_load(:active_record) do
43
47
  ActiveRecord::Base.send(:include, Uuidable::ActiveRecord)
48
+ ActiveRecord::Relation.send(:prepend, Uuidable::ActiveRecord::Finder)
44
49
  end
@@ -1,3 +1,3 @@
1
1
  module Uuidable
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uuidable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Gnuskov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-23 00:00:00.000000000 Z
11
+ date: 2017-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  requirements: []
157
157
  rubyforge_project:
158
- rubygems_version: 2.4.8
158
+ rubygems_version: 2.6.12
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: Helps using uuid everywhere in routes instead of id for ActiveRecord models.