tsubaki 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: 610420f558197c1c9c9caea8f6dc1ae4f6bc507b
4
- data.tar.gz: 482b6a9fecb8cc423fdaa606242b26b5bfa53889
3
+ metadata.gz: e6c8b5daa3f8151cfd170d4f2fba3c99468fa188
4
+ data.tar.gz: 5f854b1fa68205a6769b5f0e3eec30dc8ebf3e7d
5
5
  SHA512:
6
- metadata.gz: 9bc874bf0b0e19329bf29fc03a61e65e808847bf827c96a5d72b1cf594147eefc8e68206b00d2bf257ac00531d9bd7d5f1dd1b75f9eea917bad0b57da4ca1532
7
- data.tar.gz: 5beea1081c4357a8cb759ab6788079e9433104e79129d769466809ed49140413885b75b9d7c50f599ab40be9fdf64779ec9e11535a5654063137503ba36c63c0
6
+ metadata.gz: 1e0c97c7450741ef6915fb58711ef2cbe39725c9d0b6beea1215dc74ea81340abb78e00fed658a47f420a89e65076827adeaaec42c4263c2e4934b9f71a18891
7
+ data.tar.gz: 0f4bcd0366c3ad18316bf566e20b279d7e86dd1bcb8e4317d473740bca971cf68a618343a2fdaaa649c6c1a4a1a9ba8355e310897349f16a15913cf56c5622ee
data/README.md CHANGED
@@ -33,7 +33,7 @@ To validate the format of an attribute, add the following to your model:
33
33
 
34
34
  ```ruby
35
35
  # Verifies the format and its check digit with `strict` option:
36
- validates :digits, my_number: { strict: true }, allow_nil: true
36
+ validates :digits, my_number: { strict: true, allow_blank: true }
37
37
 
38
38
  # Without strict option, it verifies only the length of the digits:
39
39
  validates :digits, my_number: true
@@ -50,7 +50,7 @@ To validate the format of an attribute, add the following to your model:
50
50
 
51
51
  ```ruby
52
52
  # Verifies the format and its check digit with `strict` option:
53
- validates :digits, corporate_number: { strict: true }, allow_nil: true
53
+ validates :digits, corporate_number: { strict: true, allow_blank: true }
54
54
 
55
55
  # Without strict option, it verifies only the length of the digits:
56
56
  validates :digits, corporate_number: true
@@ -83,7 +83,7 @@ describe User do
83
83
  it { should validate_my_number_of(:digits) }
84
84
 
85
85
  # To ensure options:
86
- it { should validate_validate_my_number_of(:digits).strict.with_divider('-').allow_nil }
86
+ it { should validate_validate_my_number_of(:digits).strict.with_divider('-').allow_blank }
87
87
  end
88
88
 
89
89
  describe Company do
@@ -19,7 +19,7 @@ module Tsubaki
19
19
  @options = {}
20
20
  @options[:strict] = nil
21
21
  @options[:divider] = nil
22
- @options[:allow_nil] = nil
22
+ @options[:allow_blank] = nil
23
23
  @failure_messages = []
24
24
  self
25
25
  end
@@ -39,7 +39,7 @@ module Tsubaki
39
39
  result << " for #{@attribute_name}"
40
40
  result << ' with strict mode' if @options[:strict].present?
41
41
  result << " with divider '#{@options[:divider]}'" if @options[:divider].present?
42
- result << ' and allow nil' if @options[:allow_nil].present?
42
+ result << ' and allow blank' if @options[:allow_blank].present?
43
43
  result
44
44
  end
45
45
 
@@ -53,19 +53,19 @@ module Tsubaki
53
53
  self
54
54
  end
55
55
 
56
- def allow_nil(allow_nil = true)
57
- @options[:allow_nil] = allow_nil
56
+ def allow_blank(allow_blank = true)
57
+ @options[:allow_blank] = allow_blank
58
58
  self
59
59
  end
60
60
 
61
61
  protected
62
62
 
63
63
  def error_when_not_valid
64
- [error_test_allow_nil, error_test_strict, error_test_divider, error_test]
64
+ [error_test_allow_blank, error_test_strict, error_test_divider, error_test]
65
65
  end
66
66
 
67
67
  def no_error_when_valid
68
- [no_error_test_allow_nil, no_error_test_strict, no_error_test_divider, no_error_test]
68
+ [no_error_test_allow_blank, no_error_test_strict, no_error_test_divider, no_error_test]
69
69
  end
70
70
 
71
71
  private
@@ -77,7 +77,7 @@ module Tsubaki
77
77
  dup_subject.errors[@attribute_name].blank?
78
78
  end
79
79
 
80
- def error_test_allow_nil
80
+ def error_test_allow_blank
81
81
  true
82
82
  end
83
83
 
@@ -115,11 +115,11 @@ module Tsubaki
115
115
  end
116
116
  end
117
117
 
118
- def no_error_test_allow_nil
119
- return true if @options[:allow_nil].nil?
118
+ def no_error_test_allow_blank
119
+ return true if @options[:allow_blank].nil?
120
120
 
121
121
  if !valid_attribute_with?(nil)
122
- @failure_messages << 'allow_nil is not be specified'
122
+ @failure_messages << 'allow_blank is not be specified'
123
123
  false
124
124
  else
125
125
  true
@@ -1,3 +1,3 @@
1
1
  module Tsubaki
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: tsubaki
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
  - kakipo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-29 00:00:00.000000000 Z
11
+ date: 2015-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler