In Ruby, I'd expect that a class which has not been required would raise an "uninitialized constant" error. This is the case with CSV
, for instance.
However, Date
behaves strangely: it is available, but apparently does not work, until it is required.
~: irb
>> Date.new(2012,7,24)
ArgumentError: wrong number of arguments(3 for 0)
>> require 'date'
=> true
>> Date.new(2012,7,24)
=> #<Date: 2012-07-24 ((2456133j,0s,0n),+0s,2299161j)>
What explains this behavior?