Module: TimeCrisis::Support::Change::Date
- Defined in:
- lib/time_crisis/support/change.rb
Instance Method Summary collapse
- #beginning_of_day ⇒ Object
- #beginning_of_month ⇒ Object
- #beginning_of_year ⇒ Object
- #change(options = {}) ⇒ Object
- #end_of_day ⇒ Object
- #end_of_month ⇒ Object
- #end_of_year ⇒ Object
Instance Method Details
#beginning_of_day ⇒ Object
28 29 30 |
# File 'lib/time_crisis/support/change.rb', line 28 def beginning_of_day to_time end |
#beginning_of_month ⇒ Object
19 20 21 |
# File 'lib/time_crisis/support/change.rb', line 19 def beginning_of_month change(:day => 1) end |
#beginning_of_year ⇒ Object
11 12 13 |
# File 'lib/time_crisis/support/change.rb', line 11 def beginning_of_year change(:month => 1, :day => 1) end |
#change(options = {}) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/time_crisis/support/change.rb', line 3 def change(={}) ::Date.civil( [:year] || self.year, [:month] || self.month, [:day] || self.day ) end |
#end_of_day ⇒ Object
32 33 34 |
# File 'lib/time_crisis/support/change.rb', line 32 def end_of_day to_time.end_of_day end |
#end_of_month ⇒ Object
23 24 25 26 |
# File 'lib/time_crisis/support/change.rb', line 23 def end_of_month last_day = self.class.days_in_month(self.month, self.year) change(:day => last_day) end |
#end_of_year ⇒ Object
15 16 17 |
# File 'lib/time_crisis/support/change.rb', line 15 def end_of_year change(:month => 12, :day => 31) end |