hoodwink.d enhanced

Thu Jun 5

Red Sea, Black Sea

Shearwater

Class#initialize_with

class Class def initialize_with(*params, &block) attr_reader *params define_method(:initialize) do |*args| params.zip(args).each do |param, arg| instance_variable_set("@#{param}", arg) end instance_eval(&block) if block_given? end end end class Account initialize_with :username, :password do p "Initializing..." # Initialization code end end Account.new 'joe', 'secret' "Initializing..." # => #<Account @password="secret", @username="joe">
Sao_paolo

S„o Paulo, 1960

You have to know how to accept rejection and reject acceptance.

Ray Bradbury

Herman DŁne – I Wish That I Could See You Soon