I am building a Calendar object. It is important that I have both a date object and date as a string.
class Calendar
def initialize(on, off, date_string)
@on = on.to_i
@off = off.to_i
@date_string = date_string
end
end
I have a method that converts the date to a date Object. How to do I handle that in initialize. Do I put in a dummy value and then call it later? Do I call it from inside initialize. What is more idiomatic Ruby?
I’d put it right in the initializer like this: