On Feb 8, 2:44 pm, David Kahn <[email protected]> wrote:
> I have this line, where the input variables in the array can come in any
> form --- string, integer, fixnum, float (ps, I know that sales_price as a
> currency should really be BigDecimal or the like on instantiation, this is
> just to illustrate my question):
>
> [quantity, sales_price].each { |multiplicand| multiplicand =
> BigDecimal.new(multiplicand.to_s) if multiplicand.class != BigDecimal}
>
[snip]

All each does is iterate over a collection, yielding to the block.
when you do multiplicand = blah, you are just setting the local
variable multiplicand to point at some new object - you're not
mutating the actual object.

Fred

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to