snils 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: 91cdf5ebb2a1c759d2a516c727f57b76608a0c6d
4
- data.tar.gz: b09a5d8567ea381ba33266f35675e62f3d9d1f20
3
+ metadata.gz: 99c4655619df5fecbcaaa1dac708f9fbb38405f2
4
+ data.tar.gz: 207dc1ae3644b46612577782e8abe73170ce12d4
5
5
  SHA512:
6
- metadata.gz: 68e09826f0a41d26ee283eb7f84c39bf4df40a87662a7830879e465922a4cada26845bdc1780e586832756b3a362e5bc1a478bfdeb61a2b7934105b0ac3e871d
7
- data.tar.gz: d190281341892789efde45ecabe5398886bfa57b0825016e9785a6db0856a600a83ff24ee5242cd61cb3d112f5644951960dfc12477ea1b11521640d0003bd14
6
+ metadata.gz: 4f84bff954d0023d02045428eef5f3982afece00c5a1b7fa5964e580c07cf27abc0d2e3d9a0cbd2962e40c5ba5f9912e6168eb3a7b5516aa895c177043e3c7e5
7
+ data.tar.gz: c154aff4dec2ae7e159272c7a733a48f6b02a16ced43e24e540c6f3a63847f57d4df4a19f5db0c73349fc9009e7805762682b4c7273225095f9792e8244485d8
data/README.md CHANGED
@@ -100,7 +100,7 @@ end
100
100
  validates :snils, presence: true, uniqueness: true, snils: true
101
101
 
102
102
  def snils=(value)
103
- Snils.new(value).raw
103
+ write_attribute(:snils, Snils.new(value).raw)
104
104
  end
105
105
  end
106
106
  ```
@@ -95,7 +95,7 @@ end
95
95
  validates :snils, presence: true, uniqueness: true, snils: true
96
96
 
97
97
  def snils=(value)
98
- Snils.new(value).raw
98
+ write_attribute(:snils, Snils.new(value).raw)
99
99
  end
100
100
  end
101
101
  ```
@@ -12,8 +12,12 @@ require 'snils'
12
12
  #
13
13
  # validates :snils, presence: true, uniqueness: true, snils: true
14
14
  #
15
+ # Be aware of fact, that this validation doesn't require the value presence,
16
+ # use <tt>presence: true</tt> to require SNILS to be present.
17
+ #
15
18
  class SnilsValidator < ActiveModel::EachValidator
16
19
  def validate_each(record, attribute, value)
20
+ return if value.blank?
17
21
  snils = Snils.new(value)
18
22
  if snils.errors.any? && options[:message]
19
23
  record.errors.add(attribute, options[:message])
@@ -1,3 +1,3 @@
1
1
  class Snils
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snils
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
  - Andrey Novikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-01 00:00:00.000000000 Z
11
+ date: 2014-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler