From: Michael Fellinger Date: 2008-07-14T06:47:22+09:00 Subject: Re: Passing arguments to a class, how do? On Mon, Jul 14, 2008 at 4:18 AM, Luiz Vitor Martinez Cardoso wrote: > I'm learning Ruby, and i need to solve a problem: > > > class Person > def namer=(name, surname) > @var = name > @car = surname > end > end > > object = Person.new > object.namer = (how to pass the params here) ? Usually it's better to do this via initialize class Person def initialize(name, surname) @name, @surname = name, surname end end Person.new('Max', 'Mustermann') You can combine that with attr_accessor class Person attr_accessor :name, :surname def initialize(name = nil, surname = nil @name, @surname = name, surname end end person = Person.new('Max') person.surname = 'Mustermann' > Thanks for your attention!