Hi,

From: "Stephen Taylor" <sjt / 5jt.com>
>
[...]
>
>     class Money
>     attr_accessor :value
>         def to_s
>             ' + @value.to_s
>         end
>     end
>
> permits:
>
>     m = Money.new
>     m.value= 1234
>     puts m.to_s
>     "234"
>
> Question: can we create and set in one move? We imagine
>
>     n = Money.new(1234)
>
> But if we:
>
>     def Method.new(amt)
>         initialize
>         @value = amt
>     end

Is Method.new a typo for Money.new?

But instead, try defining an initialize method, rather than new, like:

  class Money
    def initialize(amt)
      @value = amt
    end
  end

Then:  n = Money.new(1234)

should do what you wanted..


Hope this helps,

Bill