On Wed, Jan 19, 2011 at 1:14 AM, Eric Christopherson
<echristopherson / gmail.com> wrote:

> 2. It would be nice to have a little sugar for initialize methods that
> set instance variables without any checking or computation, similarly
> to how attribute writers work. I believe constructors in Scala have an
> elegant way of doing this.

Often you can use Struct:

Foo = Struct.new :name, :age do
  def to_s
    "name=#{name},age=#{age}"
  end

  def any_other_method
    self.age += 1
  end
end

f = Foo.new "bar", 17
puts f

Cheers

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/