Method: Code::Object::Date#code_change

Defined in:
lib/code/object/date.rb

#code_change(year: nil, month: nil, day: nil) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/code/object/date.rb', line 139

def code_change(year: nil, month: nil, day: nil)
  code_year = year.to_code
  code_month = month.to_code
  code_day = day.to_code

  raw.change(
    **{
      year: code_year.raw,
      month: code_month.raw,
      day: code_day.raw
    }.compact
  )

  self
end