gourami 0.2.0 → 0.3.0
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 +4 -4
- data/lib/gourami/validations.rb +5 -5
- data/lib/gourami/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57a2782368b91dd6d00f1fd52402fe45fc631436
|
4
|
+
data.tar.gz: b48276105fc9f4028bba1fc7ca08ab65d3e6708a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4621445ee8bad894787813e7a00b6c67a7d1b0d02ac364c0ddc953ce76b6afb0e421a393ef39f49578662254e10383fa25e1e1c66a2f94675d546af2f28462f
|
7
|
+
data.tar.gz: db710b63482399707da8e3a78928315f9535b1be8166a63c2fbf4ae7d2b7aafed884dbf4100c055da8483800d301dcc626c950dec78e3a06f4a7033d0e3401f4
|
data/lib/gourami/validations.rb
CHANGED
@@ -96,7 +96,7 @@ module Gourami
|
|
96
96
|
# A block to determine if a given value is unique or not. It receives
|
97
97
|
# the value and returns true if the value is unique.
|
98
98
|
def validate_uniqueness(attribute_name, message = nil, &block)
|
99
|
-
value =
|
99
|
+
value = send(attribute_name)
|
100
100
|
unless block.call(value)
|
101
101
|
append_error(attribute_name, message || :is_duplicated)
|
102
102
|
end
|
@@ -124,7 +124,7 @@ module Gourami
|
|
124
124
|
# @param attribute_name [Symbol]
|
125
125
|
# @param format [Regexp]
|
126
126
|
def validate_format(attribute_name, format, message = nil)
|
127
|
-
value =
|
127
|
+
value = send(attribute_name)
|
128
128
|
if value && !(format =~ value)
|
129
129
|
append_error(attribute_name, message || :is_invalid)
|
130
130
|
end
|
@@ -144,7 +144,7 @@ module Gourami
|
|
144
144
|
|
145
145
|
min = options.fetch(:min, nil)
|
146
146
|
max = options.fetch(:max, nil)
|
147
|
-
value =
|
147
|
+
value = send(attribute_name)
|
148
148
|
|
149
149
|
return if options[:allow_blank] && value.blank?
|
150
150
|
|
@@ -166,7 +166,7 @@ module Gourami
|
|
166
166
|
# @param attribute_name [Symbol]
|
167
167
|
# @param list [Array]
|
168
168
|
def validate_inclusion(attribute_name, list, message = nil)
|
169
|
-
value =
|
169
|
+
value = send(attribute_name)
|
170
170
|
if value && !list.include?(value)
|
171
171
|
append_error(attribute_name, message || :isnt_listed)
|
172
172
|
end
|
@@ -189,7 +189,7 @@ module Gourami
|
|
189
189
|
#
|
190
190
|
# @param attribute_name [Symbol]
|
191
191
|
def validate_any(attribute_name, message = nil)
|
192
|
-
value =
|
192
|
+
value = send(attribute_name)
|
193
193
|
if value && value.empty?
|
194
194
|
append_error(attribute_name, message || :cant_be_empty)
|
195
195
|
end
|
data/lib/gourami/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gourami
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TSMMark
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|