Trouble advancing date in iterator

I am trying to assemble an array of month names called
“names_of_months_paid”:

0 first_month_paid = client.first_month_paid
1 names_of_months_paid = []
2 number_of_months_paid.times do
3 names_of_months_paid << first_month_paid.strftime("%B")
4 first_month_paid >> (1)
5 end

For each payment (“number_of_months_paid”), I need to store the name of
the month, then store the name of the next month starting from
“first_month_paid”. I seem to be having trouble advancing the month of
“first_month_paid” on line 4 as I am left with an array of first month
names. How might I get this to work?

On Nov 28, 2007 12:34 AM, Peter M. [email protected] wrote:

For each payment (“number_of_months_paid”), I need to store the name of
the month, then store the name of the next month starting from
“first_month_paid”. I seem to be having trouble advancing the month of
“first_month_paid” on line 4 as I am left with an array of first month
names. How might I get this to work?

Posted via http://www.ruby-forum.com/.

irb(main):020:0> t=Time::now
=> Wed Nov 28 11:50:38 +0100 2007
irb(main):021:0> t.month
=> 11
irb(main):022:0> Date::MONTHNAMES[t.month]
=> “November”
irb(main):023:0> m = 12
=> 12
irb(main):024:0> Date::MONTHNAMES[(m % 12 ).succ]
=> “January”
irb(main):025:0> m = 1
=> 1
irb(main):026:0> Date::MONTHNAMES[(m % 12 ).succ]
=> “February”

HTH
Robert

http://ruby-smalltalk.blogspot.com/


All truth passes through three stages. First, it is ridiculed. Second,
it is violently opposed. Third, it is accepted as being self-evident.
Schopenhauer (attr.)

Thanks for your suggestions Robert. Looks like this is all I needed to
do:

4 first_month_paid = first_month_paid >> (1)