From: "Jesús Gabriel y Galán" Date: 2012-09-27T01:26:25+09:00 Subject: Re: Subclassing Date On Wed, Sep 26, 2012 at 6:02 PM, Damián M. González wrote: > Ey guys, can't understand what's happening here: > > require 'date' > > class Dia < Date > def initialize(ano, mes, dia, obj_mes) > @mes = obj_mes > super(ano, mes, dia) > end > end > > a = Dia.new > => # > #Was expecting an error, no arguments has been passed 1.9.2p290 :001 > require 'date' => true 1.9.2p290 :002 > 1.9.2p290 :003 > class Dia < Date 1.9.2p290 :004?> def initialize(ano, mes, dia, obj_mes) 1.9.2p290 :005?> @mes = obj_mes 1.9.2p290 :006?> super(ano, mes, dia) 1.9.2p290 :007?> end 1.9.2p290 :008?> end => nil 1.9.2p290 :009 > Dia.new ArgumentError: wrong number of arguments (3 for 4) from (irb):4:in `initialize' from /home/jesus/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/date.rb:811:in `new' from /home/jesus/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/date.rb:811:in `civil' from (irb):9 from /home/jesus/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `
' What version of Ruby are you using? Jesus.