T
Ts
The following script doesn't work...
Do you have any idea of what is wrong?
Is it a ruby bug? (ruby version: ruby 1.9.1p243 (2009-07-16 revision
24175) [i386-darwin9])
require 'time'
Time.parse("1999-10-31 16:46:50") # this works
class String
alias_method ld_sub!, :sub!
def sub!(*args, &block)
old_sub!(*args, &block)
end
end
Time.parse("1999-10-31 16:46:50") # this crashes
# =>
#
# ArgumentError: argument out of range
# from /opt/local/lib/ruby1.9/1.9.1/time.rb:202:in `local'
# from /opt/local/lib/ruby1.9/1.9.1/time.rb:202:in `make_time'
# from /opt/local/lib/ruby1.9/1.9.1/time.rb:261:in `parse'
# from (irb):10
# from /opt/local/bin/irb1.9:12:in `<main>'
Do you have any idea of what is wrong?
Is it a ruby bug? (ruby version: ruby 1.9.1p243 (2009-07-16 revision
24175) [i386-darwin9])
require 'time'
Time.parse("1999-10-31 16:46:50") # this works
class String
alias_method ld_sub!, :sub!
def sub!(*args, &block)
old_sub!(*args, &block)
end
end
Time.parse("1999-10-31 16:46:50") # this crashes
# =>
#
# ArgumentError: argument out of range
# from /opt/local/lib/ruby1.9/1.9.1/time.rb:202:in `local'
# from /opt/local/lib/ruby1.9/1.9.1/time.rb:202:in `make_time'
# from /opt/local/lib/ruby1.9/1.9.1/time.rb:261:in `parse'
# from (irb):10
# from /opt/local/bin/irb1.9:12:in `<main>'