active_model_validators_ex 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03a37d493a2dac4b14b590fdb26d71d9b1a928fb
4
- data.tar.gz: 3aa36f058852ef5dab8c3252abae1acc76827798
3
+ metadata.gz: 854badf7303345d29a041e94264d9db10b3157c7
4
+ data.tar.gz: 067a7ec5466cb199761cb861a4ef431e6a2dc53f
5
5
  SHA512:
6
- metadata.gz: 2cd9f57d149c03b4394003d9e37b8abcd16f31519103f625776b3155b7a6c14b7aae4a9144a4293deb3b5f1864f532194a088a8497cb8a67776bb1cb611ee289
7
- data.tar.gz: 92e9992f602a4fb2605a06bf83ea646ded3ef0ee5030e68a4eb35799a7a10d540a82f60278298c72895e5d0ff8b5874a14e7f885384600bf6818d9c946798a7b
6
+ metadata.gz: 9d9a52f18b2251efb6985fb8aa303f5ccb3b26c60893452029044513059cb8423707ea0f193edff321c693e51b6130943170109957027292165bdfdc552c2203
7
+ data.tar.gz: 4e15babcff28e0ff909fc4fb6f5ff07cc3d102fab4836fce07cb3941a6c61f6c36d235e2b9fddee69a325fbb6f7a415d243821e8ba804f6e50b8200a98c54556
@@ -4,18 +4,19 @@ class TimeFormatValidator < ActiveModel::EachValidator
4
4
 
5
5
  parsed_time = value.is_a?(Time) ? value : Time.parse(value.to_s)
6
6
 
7
- previous_time = \
8
- case options[:after].class.name
9
- when 'Proc'
10
- options[:after].call
11
- when 'Time'
12
- options[:after]
13
- end
14
-
15
7
  if !previous_time.nil? and parsed_time < previous_time
16
8
  record.errors[attribute] << "invalid value, #{value} must be after #{previous_time}"
17
9
  end
18
10
  rescue StandardError => e
19
11
  record.errors[attribute] << "invalid value, #{value} not valid for #{attribute}"
20
12
  end
13
+
14
+ def previous_time
15
+ case options[:after].class.name
16
+ when 'Proc'
17
+ options[:after].call
18
+ when 'Time'
19
+ options[:after]
20
+ end
21
+ end
21
22
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveModelValidatorsEx
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model_validators_ex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - junhanamaki