validates_duplicity_of 0.2.0 → 0.2.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: b8059f9febbe7dfc82d2ca9ac828303efaf1ed74
4
- data.tar.gz: 2dd82ed7bd23ebc3c28c9bcbb22d15bd07099c8b
3
+ metadata.gz: 34399f4b894fc7fa23c9fd6e3b4c67450ca6beaa
4
+ data.tar.gz: a93f6e124232d3b6580751c87dd220e3449cec94
5
5
  SHA512:
6
- metadata.gz: 25591738d1ddb68caf0fa024d42a55a41c7b77e1256bf8f3931ad6372eefdb5e6dbb57bc62ca3d064a4773160d354ac6b81022ca57259dceb4ebb6edfc5a84e8
7
- data.tar.gz: a2b55ebd390817312ee264abf094f1f10190b8931172c2ce5cb21e0bc81fbce1a4172a03977ad9ca2323f46d1738be98f09e841e60980d91c6f40dd73715ca7b
6
+ metadata.gz: 846803de4edb7445d19ad91344563fc37db684ee88df5d20a8e73a2675682f5349abeaad5f72468eda85d5995c5d9aed4624b25cb7c8ef842a82111f42cdd621
7
+ data.tar.gz: 0d1e52b088e22287db44cbc718771d0eeb768d27340ae07fc4f3357f9aa3ff833295e9d7b9b7acddcf720b662802c8943b2618d02b529768360b4a5c65422143
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.4
4
- - 2.3.0
3
+ - 2.2.5
4
+ - 2.3.1
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # validates_duplicity_of
2
2
 
3
- [![Build Status](https://img.shields.io/travis/madwork/validates_duplicity_of.svg)](https://travis-ci.org/madwork/validates_duplicity_of)
4
- [![Gem](https://img.shields.io/gem/v/validates_duplicity_of.svg)](https://rubygems.org/gems/validates_duplicity_of)
3
+ [![Build Status](https://travis-ci.org/madwork/validates_duplicity_of.svg)](https://travis-ci.org/madwork/validates_duplicity_of)
4
+ [![Gem](https://badge.fury.io/rb/validates_duplicity_of.svg)](https://rubygems.org/gems/validates_duplicity_of)
5
5
 
6
6
  ActiveRecord (>= 3.2) callback which handle the name duplication in your model with ease.
7
7
  Ruby 2 only!
@@ -9,7 +9,7 @@ module ValidatesDuplicityOf
9
9
 
10
10
  def before_save(record)
11
11
  duplicator = Duplicator.new self, record
12
- duplicator.validate!
12
+ duplicator.validate
13
13
  end
14
14
  end
15
15
  end
@@ -6,7 +6,7 @@ module ValidatesDuplicityOf
6
6
  end
7
7
 
8
8
  # Updates the attribute of the record
9
- def validate!
9
+ def validate
10
10
  return unless @record.update_required?
11
11
 
12
12
  if changed_attribute_match?
@@ -27,7 +27,7 @@ module ValidatesDuplicityOf
27
27
  end
28
28
 
29
29
  def where_match(pattern)
30
- scoped_relation.where __getobj__.class.arel_table[attr_name].matches(pattern)
30
+ scoped_relation.where klass.arel_table[attr_name].matches(pattern)
31
31
  end
32
32
 
33
33
  private
@@ -45,7 +45,11 @@ module ValidatesDuplicityOf
45
45
  end
46
46
 
47
47
  def scoped_relation
48
- scope ? __getobj__.class.where(scope => __getobj__[scope]) : __getobj__.class
48
+ scope ? klass.where(scope => __getobj__[scope]) : klass
49
+ end
50
+
51
+ def klass
52
+ __getobj__.class
49
53
  end
50
54
  end
51
55
  end
@@ -1,3 +1,3 @@
1
1
  module ValidatesDuplicityOf
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -10,6 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = "vincent.durand@madwork.org"
11
11
  spec.description = "ActiveRecord callback which handle the name duplication in your model."
12
12
  spec.summary = "ActiveRecord callback which handle the name duplication in your model with ease."
13
+ spec.homepage = "https://github.com/madwork/validates_duplicity_of"
13
14
  spec.license = "MIT"
14
15
 
15
16
  spec.files = `git ls-files`.split($/)
@@ -17,6 +18,8 @@ Gem::Specification.new do |spec|
17
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
19
  spec.require_paths = ["lib"]
19
20
 
21
+ spec.required_ruby_version = ">= 2.0"
22
+
20
23
  spec.add_development_dependency "bundler", "~> 1.3"
21
24
  spec.add_development_dependency "rake"
22
25
  spec.add_development_dependency "rspec", ">= 2.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_duplicity_of
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Durand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -106,7 +106,7 @@ files:
106
106
  - spec/support/models.rb
107
107
  - spec/support/schema.rb
108
108
  - validates_duplicity_of.gemspec
109
- homepage:
109
+ homepage: https://github.com/madwork/validates_duplicity_of
110
110
  licenses:
111
111
  - MIT
112
112
  metadata: {}
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
119
  - - ">="
120
120
  - !ruby/object:Gem::Version
121
- version: '0'
121
+ version: '2.0'
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - ">="
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  requirements: []
128
128
  rubyforge_project:
129
- rubygems_version: 2.5.0
129
+ rubygems_version: 2.5.1
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: ActiveRecord callback which handle the name duplication in your model with