On 2007-05-31 02:35:08 +0900 (Thu, May), [email protected]
wrote:
end
So, I would like my call to contain something like this:
login = Login.new
login.with(:username => ‘aidy’, :password => ‘aidy1’)
You can use something like this:
def with params = {}
params.each do |key,value|
m = “#{key}=”
self.send(m, value) if self.respond_to?(m)
end
end
but you should build-in additional checks which will filter out possibly
unsafe assignments, which you would not want here.
Another thing, you may want to call it ‘initialize’, to be able to use:
login = Login.new :username => ‘username’, :password => ‘pass’
BTW this is similiar to how ActiveRecord works.
–
No virus found in this outgoing message.
Checked by ‘grep -i virus $MESSAGE’
Trust me.
Tędy przebiegli, żaden z nich kroków nie szczędził
mężny ten, co uciekał, mężniejszy, co pędził.
– Homer, Iliada.
Ceterum censeo Internet Explorer esse delendam.
I have tried to Google this question, but Google said:
“Application error, Rails application failed to start properly”
() The ASCII Ribbon Campaign - against HTML Email,
/\ vCards, and proprietary formats.