auto_increment 1.4.0 → 1.4.1

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: 564b658b6b2444141f7eb814e2125c480c06301c
4
- data.tar.gz: ef6c4950e669707eac1d8f97a63e627708db2e2f
3
+ metadata.gz: 7a59855c0d5c6791ba684802c30616f621657794
4
+ data.tar.gz: 166fb4fbcc37d7c603b1c37dce095eb0f205ad78
5
5
  SHA512:
6
- metadata.gz: 7792a1be4db338672e977040591fcd57a3229da7b35f54fed2e2c04dcafadd2b1f659a4512eefbb0e14888eed60db9fcbabe3553c18c24a6f49600f0d24ec053
7
- data.tar.gz: a401806c20c58968755790e1231b5ce5f9a1490507b8e37cdb60e20670d0c9b9fe493c1d8125a637a10b91a76bd375e7278c5884629577a997e4433ccdcaa401
6
+ metadata.gz: b5d2caa72b8ef693a4ecf39bd278fd238356d966e00d8de12c7415cc3037644f7127a35425a883c06a17ab7ce1d4b5cf3400cc782312d4b594780792b0083e58
7
+ data.tar.gz: 8fca057d42bcf44c715b0c611d66b7ea98debab9a91db49d7e8037f0f45d0de279c56d7417dce412d3cc0c1e561bda2167a1d0d128504e9855474769a5782134
@@ -5,6 +5,7 @@ rvm:
5
5
  - 2.3.1
6
6
  - 2.2.5
7
7
  gemfile:
8
+ - gemfiles/rails_5.1.gemfile
8
9
  - gemfiles/rails_5.gemfile
9
10
  - gemfiles/rails_4.gemfile
10
11
 
data/Appraisals CHANGED
@@ -7,3 +7,8 @@ appraise 'rails-5' do
7
7
  gem 'activerecord', '~> 5.0'
8
8
  gem 'activesupport', '~> 5.0'
9
9
  end
10
+
11
+ appraise 'rails-5.1' do
12
+ gem 'activerecord', '~> 5.1'
13
+ gem 'activesupport', '~> 5.1'
14
+ end
data/README.md CHANGED
@@ -51,8 +51,8 @@ First argument is the column that will be incremented. Can be integer or string.
51
51
 
52
52
  ## Compatibility
53
53
 
54
- Tested with Rails 4 and Rails 5 in Ruby 2.2.5 and Ruby 2.3.1
54
+ Tested with Rails 4, Rails 5 and Rails 5.1 in Ruby 2.2.5 and Ruby 2.3.1
55
55
 
56
56
  ## License
57
57
 
58
- MIT License. Copyright 2011 29sul Tecnologia da Informação <http://www.29sul.com.br/>
58
+ MIT License
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.require_paths = ['lib']
20
20
 
21
- s.add_dependency 'activerecord', '>= 4.0', '< 5.1'
22
- s.add_dependency 'activesupport', '>= 4.0', '< 5.1'
21
+ s.add_dependency 'activerecord', '>= 4.0', '< 5.2'
22
+ s.add_dependency 'activesupport', '>= 4.0', '< 5.2'
23
23
 
24
24
  s.add_development_dependency 'bundler'
25
25
  s.add_development_dependency 'rake'
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "activerecord", "~> 5.1"
6
+ gem "activesupport", "~> 5.1"
7
+
8
+ group :development do
9
+ gem "appraisal"
10
+ end
11
+
12
+ gemspec :path => "../"
@@ -8,9 +8,9 @@ module AutoIncrement
8
8
  def auto_increment(column = nil, options = {})
9
9
  options.reverse_merge! before: :create
10
10
 
11
- callback = "before_#{ options[:before]}"
11
+ callback = "before_#{options[:before]}"
12
12
 
13
- self.send callback, Incrementor.new(column, options)
13
+ send callback, Incrementor.new(column, options)
14
14
  end
15
15
  end
16
16
  end
@@ -18,8 +18,8 @@ module AutoIncrement
18
18
  write if can_write?
19
19
  end
20
20
 
21
- alias_method :before_validation, :before_create
22
- alias_method :before_save, :before_create
21
+ alias before_validation before_create
22
+ alias before_save before_create
23
23
 
24
24
  private
25
25
 
@@ -47,8 +47,8 @@ module AutoIncrement
47
47
 
48
48
  if string?
49
49
  query.select("#{@column} max")
50
- .order("LENGTH(#{@column}) DESC, #{@column} DESC")
51
- .first.try :max
50
+ .order("LENGTH(#{@column}) DESC, #{@column} DESC")
51
+ .first.try :max
52
52
  else
53
53
  query.maximum @column
54
54
  end
@@ -1,4 +1,4 @@
1
1
  # +AutoIncrement::VERSION+
2
2
  module AutoIncrement
3
- VERSION = '1.4.0'
3
+ VERSION = '1.4.1'.freeze
4
4
  end
Binary file
@@ -54,12 +54,10 @@ describe AutoIncrement do
54
54
  it { expect(account_last_letter_code).to eq 'Y' }
55
55
  end
56
56
 
57
-
58
57
  describe 'set before validation' do
59
58
  account3 = Account.new
60
59
  account3.valid?
61
60
 
62
61
  it { expect(account3.code).not_to be_nil }
63
62
  end
64
-
65
63
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto_increment
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Diesel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-04 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.1'
22
+ version: '5.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.1'
32
+ version: '5.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '4.0'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '5.1'
42
+ version: '5.2'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '4.0'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '5.1'
52
+ version: '5.2'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: bundler
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -209,6 +209,7 @@ files:
209
209
  - Rakefile
210
210
  - auto_increment.gemspec
211
211
  - gemfiles/rails_4.gemfile
212
+ - gemfiles/rails_5.1.gemfile
212
213
  - gemfiles/rails_5.gemfile
213
214
  - lib/auto_increment.rb
214
215
  - lib/auto_increment/active_record.rb
@@ -242,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
243
  version: '0'
243
244
  requirements: []
244
245
  rubyforge_project:
245
- rubygems_version: 2.5.1
246
+ rubygems_version: 2.5.2
246
247
  signing_key:
247
248
  specification_version: 4
248
249
  summary: Auto increment a string or integer field