gourami 0.2.0 → 0.3.0

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: f97edb63e52af97e6e63f41a74a824a04da00c21
4
- data.tar.gz: 74bff6e2f3563c96205fc155f0b21db04df37169
3
+ metadata.gz: 57a2782368b91dd6d00f1fd52402fe45fc631436
4
+ data.tar.gz: b48276105fc9f4028bba1fc7ca08ab65d3e6708a
5
5
  SHA512:
6
- metadata.gz: f2ea15a122976499b06265949d859767170c66d7647bac35861a9bea9e8b95f2090da92bd8f6ee99f7677c59eb5ce47ab59d25e21922a2a6a2dd4698cd279d4e
7
- data.tar.gz: a38f7c552c0939c3122171945e855e4edff4482206e8c4e1a5b82d9100a92d1de2ce462bffbee147804fdb763ecc042dd550f441cee909f26b54922e2cd3e78c
6
+ metadata.gz: d4621445ee8bad894787813e7a00b6c67a7d1b0d02ac364c0ddc953ce76b6afb0e421a393ef39f49578662254e10383fa25e1e1c66a2f94675d546af2f28462f
7
+ data.tar.gz: db710b63482399707da8e3a78928315f9535b1be8166a63c2fbf4ae7d2b7aafed884dbf4100c055da8483800d301dcc626c950dec78e3a06f4a7033d0e3401f4
@@ -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 = attributes[attribute_name]
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 = attributes[attribute_name]
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 = attributes[attribute_name]
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 = attributes[attribute_name]
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 = attributes[attribute_name]
192
+ value = send(attribute_name)
193
193
  if value && value.empty?
194
194
  append_error(attribute_name, message || :cant_be_empty)
195
195
  end
@@ -1,3 +1,3 @@
1
1
  module Gourami
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
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.2.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: 2017-11-08 00:00:00.000000000 Z
11
+ date: 2018-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry