Is there a way to have multiple “initializing” methods in ruby? For example: one method excluding one argument, while the other excludes three?
Sort of
class One def initialize (a) puts a end def initialize_1 (a,b) puts a ,b end end
initializenot really a constructor. You really can have two constructors.
initialize
class One singletonclass.class_eval{alias old_new :new} def self.new a puts a old_new end def self.new_1 a, b puts a, b old_new end end