Module: ActiveSupport::CoreExtensions::Date::Calculations::ClassMethods
- Defined in:
- lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/calculations.rb
Instance Method Summary collapse
-
#current ⇒ Object
Returns Time.zone.today when config.time_zone is set, otherwise just returns Date.today.
-
#tomorrow ⇒ Object
Returns a new Date representing the date 1 day after today (i.e. tomorrow’s date).
-
#yesterday ⇒ Object
Returns a new Date representing the date 1 day ago (i.e. yesterday’s date).
Instance Method Details
#current ⇒ Object
Returns Time.zone.today when config.time_zone is set, otherwise just returns Date.today.
30 31 32 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/calculations.rb', line 30 def current ::Time.zone_default ? ::Time.zone.today : ::Date.today end |
#tomorrow ⇒ Object
Returns a new Date representing the date 1 day after today (i.e. tomorrow’s date).
25 26 27 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/calculations.rb', line 25 def tomorrow ::Date.today.tomorrow end |
#yesterday ⇒ Object
Returns a new Date representing the date 1 day ago (i.e. yesterday’s date).
20 21 22 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/calculations.rb', line 20 def yesterday ::Date.today.yesterday end |