validates_timeliness 5.0.0.alpha1 → 5.0.0.alpha2

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
  SHA256:
3
- metadata.gz: 66a4ad3b4dbb1cda9d19921e18b17bf30029679689d331aafa699a2a3bb447a5
4
- data.tar.gz: 1877d86f268f923d7dd344f2fc6965fbf8d5a207d3d669e3255f094709520a72
3
+ metadata.gz: d5866702e0869b2d7f93449cb58dc8db475a458cf0b6f90b3c2bb4b486e045ab
4
+ data.tar.gz: a5c597d6afefa7e48d83a4eb3582581201452912601fa040a6bc6fe62469748e
5
5
  SHA512:
6
- metadata.gz: a3df0f1b7817dbf16b3d9c502488974a2acbbe858d65641a186cf73afb2499d10de484918ff20097396cf2f9295dd88c083de64328510bed53b112e058439663
7
- data.tar.gz: 1c9a48cdc41249bed2e75b9087b848e30dd5d9743489bac304aa4a255c374053437f397495b2447ceea1f2af1ae383e5e1b421055d68a86d0abbcde335c7fc46
6
+ metadata.gz: 725bc85ef17857f8ae9df14f84f5255fe2fcb2d84d71db804f69957fc5a6eca504412af2401c49f07545d160e06036b2b29392ddf3cb89d87bb9db2ae49e49ac
7
+ data.tar.gz: 02a37feefa774fbd7444ad77eee49fdffe8bbff075f6134b64e9611ca10d447f4ad9474c6ee5eba20016ef05a70a9170b10d325861181b7e9282559b2bc4d5b2
data/README.rdoc CHANGED
@@ -30,7 +30,7 @@ If you a looking for the old version for Rails 4.x go here [https://github.com/a
30
30
  == Installation
31
31
 
32
32
  # in Gemfile
33
- gem 'validates_timeliness', '~> 5.0.0.pre'
33
+ gem 'validates_timeliness', '~> 5.0.0.alpha2'
34
34
 
35
35
  # Run bundler
36
36
  $ bundle install
@@ -9,36 +9,36 @@ module ValidatesTimeliness
9
9
  end
10
10
  end
11
11
 
12
- ActiveModel::Type::Date.class_eval do
13
- # Module.new do |m|
14
- def cast_value(value)
15
- return super unless ValidatesTimeliness.use_plugin_parser
12
+ ActiveModel::Type::Date.prepend Module.new {
13
+ def cast_value(value)
14
+ return super unless ValidatesTimeliness.use_plugin_parser
16
15
 
17
- if value.is_a?(::String)
18
- return if value.empty?
19
- value = Timeliness::Parser.parse(value, :date)
20
- value.to_date if value
21
- elsif value.respond_to?(:to_date)
22
- value.to_date
23
- else
24
- value
25
- end
16
+ if value.is_a?(::String)
17
+ return if value.empty?
18
+ value = Timeliness::Parser.parse(value, :date)
19
+ value.to_date if value
20
+ elsif value.respond_to?(:to_date)
21
+ value.to_date
22
+ else
23
+ value
26
24
  end
27
- # end.tap { |mod| include mod }
28
- end
25
+ end
26
+ }
29
27
 
30
- ActiveModel::Type::Time.class_eval do
28
+ ActiveModel::Type::Time.prepend Module.new {
31
29
  def user_input_in_time_zone(value)
32
- if value.is_a?(String) && ValidatesTimeliness.use_plugin_parser
30
+ return super unless ValidatesTimeliness.use_plugin_parser
31
+
32
+ if value.is_a?(String)
33
33
  dummy_time_value = value.sub(/\A(\d\d\d\d-\d\d-\d\d |)/, Date.current.to_s + ' ')
34
34
  Timeliness::Parser.parse(dummy_time_value, :datetime, zone: :current)
35
35
  else
36
36
  value.in_time_zone
37
37
  end
38
38
  end
39
- end
39
+ }
40
40
 
41
- ActiveModel::Type::DateTime.class_eval do
41
+ ActiveModel::Type::DateTime.prepend Module.new {
42
42
  def user_input_in_time_zone(value)
43
43
  if value.is_a?(String) && ValidatesTimeliness.use_plugin_parser
44
44
  Timeliness::Parser.parse(value, :datetime, zone: :current)
@@ -46,4 +46,4 @@ ActiveModel::Type::DateTime.class_eval do
46
46
  value.in_time_zone
47
47
  end
48
48
  end
49
- end
49
+ }
@@ -1,3 +1,3 @@
1
1
  module ValidatesTimeliness
2
- VERSION = '5.0.0.alpha1'
2
+ VERSION = '5.0.0.alpha2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_timeliness
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.alpha1
4
+ version: 5.0.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Meehan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-10 00:00:00.000000000 Z
11
+ date: 2018-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: timeliness