P
Pablo Lorenzzoni
Hello!
class Klass
attr_accessor :att1, :att2
def initialize(att1, att2)
@att1 = att1
@att2 = att2
end
....
end
Is it just me or the construction above is rather common? Is there such a
thing as a default cosntructor? Something that could turn that into
class Klass
attr_accessor :att1, att2
initializer(att1,att2)
end
or even
class Klass
attr_accessor :att1, :att2
initializer
end
Since we have short cuts as attr_accessor, attr_writer and attr_reader,
shouldn't we have a constructor short cut?
Anyway... just a crazy thought that just hit me now. What do you think about
it?
[]s
Pablo
class Klass
attr_accessor :att1, :att2
def initialize(att1, att2)
@att1 = att1
@att2 = att2
end
....
end
Is it just me or the construction above is rather common? Is there such a
thing as a default cosntructor? Something that could turn that into
class Klass
attr_accessor :att1, att2
initializer(att1,att2)
end
or even
class Klass
attr_accessor :att1, :att2
initializer
end
Since we have short cuts as attr_accessor, attr_writer and attr_reader,
shouldn't we have a constructor short cut?
Anyway... just a crazy thought that just hit me now. What do you think about
it?
[]s
Pablo