I'm writing a new class, and in the initialize I have:
@args = args
@args[:start_at] = 30.days.ago if @args[:start_at].nil?
@args[:finish_at] = Date.today if @args[:finish_at].nil?
@customer = Customer.find(@args[:customer_id])
This allows me, as you can see, to use @args[:customer_id] for example
to read arguments passed to the initialize. This is helpful in case I
need to add some more arguments to my method without breaking existing
This code is currently working (did not test it very long).
My question is: Why do I have to do the @args = args thingy? I
mean, I noticed that args was an Array instead of a hash, so thats why
I did it. Is this correct? It doesnt look good...