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 +4 -4
- data/README.rdoc +1 -1
- data/lib/validates_timeliness/attribute_methods.rb +20 -20
- data/lib/validates_timeliness/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5866702e0869b2d7f93449cb58dc8db475a458cf0b6f90b3c2bb4b486e045ab
|
4
|
+
data.tar.gz: a5c597d6afefa7e48d83a4eb3582581201452912601fa040a6bc6fe62469748e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 725bc85ef17857f8ae9df14f84f5255fe2fcb2d84d71db804f69957fc5a6eca504412af2401c49f07545d160e06036b2b29392ddf3cb89d87bb9db2ae49e49ac
|
7
|
+
data.tar.gz: 02a37feefa774fbd7444ad77eee49fdffe8bbff075f6134b64e9611ca10d447f4ad9474c6ee5eba20016ef05a70a9170b10d325861181b7e9282559b2bc4d5b2
|
data/README.rdoc
CHANGED
@@ -9,36 +9,36 @@ module ValidatesTimeliness
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
ActiveModel::Type::Date.
|
13
|
-
|
14
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
28
|
-
|
25
|
+
end
|
26
|
+
}
|
29
27
|
|
30
|
-
ActiveModel::Type::Time.
|
28
|
+
ActiveModel::Type::Time.prepend Module.new {
|
31
29
|
def user_input_in_time_zone(value)
|
32
|
-
|
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
|
-
|
39
|
+
}
|
40
40
|
|
41
|
-
ActiveModel::Type::DateTime.
|
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
|
-
|
49
|
+
}
|
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.
|
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-
|
11
|
+
date: 2018-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: timeliness
|