Module: DateExtensions
- Defined in:
- lib/date_extensions.rb
Overview
Useful extensions copied from ActiveSupport::CoreExt
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- COMMON_YEAR_DAYS_IN_MONTH =
[nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
18 19 20 |
# File 'lib/date_extensions.rb', line 18 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#beginning_of_month ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/date_extensions.rb', line 22 def beginning_of_month self.class.new( year, month, 1 ) end |
#end_of_month ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/date_extensions.rb', line 30 def end_of_month self.class.new( year, month, self.class.days_in_month(month, year) ) end |