Class: Date

Inherits:
Object
  • Object
show all
Defined in:
lib/always_be_contributing/core_ext/date/month_calculator.rb

Instance Method Summary collapse

Instance Method Details

#beginning_of_monthObject



2
3
4
# File 'lib/always_be_contributing/core_ext/date/month_calculator.rb', line 2

def beginning_of_month
  change(day: 1)
end

#change(options) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/always_be_contributing/core_ext/date/month_calculator.rb', line 5

def change(options)
  ::Date.new(
    options.fetch(:year, year),
    options.fetch(:month, month),
    options.fetch(:day, day)
  )
end