Can require 'date' be used in irb

i get a lot of errors when i require ‘date’ in irb what’s wrong
=> [“c:/ruby/lib/ruby/site_ruby/1.8”,
“c:/ruby/lib/ruby/site_ruby/1.8/i386-ms
t”, “c:/ruby/lib/ruby/site_ruby”, “c:/ruby/lib/ruby/1.8”,
“c:/ruby/lib/ruby/1
i386-mswin32”, “.”]
irb(main):003:0> require ‘c:/ruby/lib/ruby/1.8/date.rb’
c:/ruby/lib/ruby/1.8/date.rb:238: warning: already initialized constant
MONTH
ES
c:/ruby/lib/ruby/1.8/date.rb:243: warning: already initialized constant
DAYNA

c:/ruby/lib/ruby/1.8/date.rb:247: warning: already initialized constant
ABBR_
THNAMES
c:/ruby/lib/ruby/1.8/date.rb:250: warning: already initialized constant
ABBR_
NAMES
c:/ruby/lib/ruby/1.8/date.rb:254: warning: already initialized constant
ITALY
c:/ruby/lib/ruby/1.8/date.rb:258: warning: already initialized constant
ENGLA
c:/ruby/lib/ruby/1.8/date.rb:262: warning: already initialized constant
JULIA
c:/ruby/lib/ruby/1.8/date.rb:266: warning: already initialized constant
GREGO
N
NameError: undefined method today' forDateTime’
from c:/ruby/lib/ruby/1.8/date.rb:1261:in `undef_method’
from c:/ruby/lib/ruby/1.8/date.rb:1261
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
quire__’
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
quire’

On Jun 30, 2006, at 9:01 PM, dave rose wrote:

ES
ABBR_
c:/ruby/lib/ruby/1.8/date.rb:266: warning: already initialized
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
quire’


Posted via http://www.ruby-forum.com/.

You’re trying too hard. Just do
require ‘date’

(What’s happening is that date has already been required and added to
$LOADED_FEATURES. But since you use the full path to date it
doesn’t realize it’s been required and requires the file again,
giving you all those lovely errors. (The reason date has been already
required is probably that you have RUBYOPT set to load rubygems))

sounds like your install is messed up:

Mini:~ kev$ irb
irb(main):001:0> require ‘date’
=> true

Hello Logan,

LC> On Jun 30, 2006, at 9:01 PM, dave rose wrote:
LC> (What’s happening is that date has already been required and added
to
LC> $LOADED_FEATURES. But since you use the full path to date it

You are right, but i hope that somebody changes this in the future.
Storing relative file paths should be forbidden. It’s not that
difficult in this case but it gets a real problem if it is relative to
“.” and some library code changes the current working directory.

It is also a pure horror for us tool writers.

On Jun 30, 2006, at 9:59 PM, Lothar S. wrote:

“.” and some library code changes the current working directory.
1.9 stores full paths.


Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs