Class: ValidatesTimeliness::Extensions::DateTimeSelect::TimelinessDateTime
- Inherits:
-
Object
- Object
- ValidatesTimeliness::Extensions::DateTimeSelect::TimelinessDateTime
- Defined in:
- lib/validates_timeliness/extensions/date_time_select.rb
Instance Attribute Summary collapse
-
#day ⇒ Object
Returns the value of attribute day.
-
#hour ⇒ Object
Returns the value of attribute hour.
-
#min ⇒ Object
Returns the value of attribute min.
-
#month ⇒ Object
Returns the value of attribute month.
-
#sec ⇒ Object
Returns the value of attribute sec.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
-
#change(options) ⇒ Object
adapted from activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 36 (3.0.7).
-
#initialize(year, month, day, hour, min, sec) ⇒ TimelinessDateTime
constructor
A new instance of TimelinessDateTime.
Constructor Details
#initialize(year, month, day, hour, min, sec) ⇒ TimelinessDateTime
Returns a new instance of TimelinessDateTime.
19 20 21 |
# File 'lib/validates_timeliness/extensions/date_time_select.rb', line 19 def initialize(year, month, day, hour, min, sec) @year, @month, @day, @hour, @min, @sec = year, month, day, hour, min, sec end |
Instance Attribute Details
#day ⇒ Object
Returns the value of attribute day.
17 18 19 |
# File 'lib/validates_timeliness/extensions/date_time_select.rb', line 17 def day @day end |
#hour ⇒ Object
Returns the value of attribute hour.
17 18 19 |
# File 'lib/validates_timeliness/extensions/date_time_select.rb', line 17 def hour @hour end |
#min ⇒ Object
Returns the value of attribute min.
17 18 19 |
# File 'lib/validates_timeliness/extensions/date_time_select.rb', line 17 def min @min end |
#month ⇒ Object
Returns the value of attribute month.
17 18 19 |
# File 'lib/validates_timeliness/extensions/date_time_select.rb', line 17 def month @month end |
#sec ⇒ Object
Returns the value of attribute sec.
17 18 19 |
# File 'lib/validates_timeliness/extensions/date_time_select.rb', line 17 def sec @sec end |
#year ⇒ Object
Returns the value of attribute year.
17 18 19 |
# File 'lib/validates_timeliness/extensions/date_time_select.rb', line 17 def year @year end |
Instance Method Details
#change(options) ⇒ Object
adapted from activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 36 (3.0.7)
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/validates_timeliness/extensions/date_time_select.rb', line 24 def change() TimelinessDateTime.new( [:year] || year, [:month] || month, [:day] || day, [:hour] || hour, [:min] || ([:hour] ? 0 : min), [:sec] || (([:hour] || [:min]) ? 0 : sec) ) end |