markos_validates_timeliness 2.3.2 → 2.3.2.1

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.
@@ -23,7 +23,35 @@ module ValidatesTimeliness
23
23
  base.alias_method_chain :value, :timeliness
24
24
  end
25
25
 
26
- TimelinessDateTime = Struct.new(:year, :month, :day, :hour, :min, :sec)
26
+ class TimelinessDateTime
27
+
28
+ attr_accessor :year, :month, :day, :hour, :min, :sec
29
+
30
+
31
+ def initialize(year, month, day, hour, min, sec)
32
+
33
+ @year = year
34
+ @month = month
35
+ @day = day
36
+ @hour = hour
37
+ @min = min
38
+ @sec = sec
39
+ end
40
+
41
+ # adapted from activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 36 (3.0.7)
42
+
43
+ def change(options)
44
+ TimelinessDateTime.new(
45
+ options[:year] || year,
46
+ options[:month] || month,
47
+ options[:day] || day,
48
+ options[:hour] || hour,
49
+ options[:min] || (options[:hour] ? 0 : min),
50
+ options[:sec] || ((options[:hour] || options[:min]) ? 0 : sec)
51
+ )
52
+ end
53
+ end
54
+
27
55
 
28
56
  def datetime_selector_with_timeliness(*args)
29
57
  @timeliness_date_or_time_tag = true
metadata CHANGED
@@ -1,18 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markos_validates_timeliness
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 125
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 3
9
9
  - 2
10
- version: 2.3.2
10
+ - 1
11
+ version: 2.3.2.1
11
12
  platform: ruby
12
13
  authors:
13
14
  - Adam Meehan
14
15
  - Marko Iskander
15
- autorequire: markos_validates_timeliness
16
+ autorequire: validates_timeliness
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
@@ -21,7 +22,7 @@ default_executable:
21
22
  dependencies: []
22
23
 
23
24
  description: Date and time validation plugin for Rails 2.x which allows custom formats
24
- email: markoiskander@gmail.com
25
+ email: adam.meehan@gmail.com
25
26
  executables: []
26
27
 
27
28
  extensions: []