Forum: Ruby "Unrequire" a file ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Tuka O. (Guest)
on 2006-04-27 16:31
Hi,

after making changes to a particular file,
I would either like to overwrite the already included one or 'unrequire'
the existing one. Is this possible ?

My tests below indicate it is not...

TIA,
Tuka


C:\Ruby\hotelreg>ruby script/console
Loading development environment.
>> require 'db/migrate/001_tb_hotel.rb'
=> true
>> TbHotel.down
== TbHotel: reverting
=========================================================
-- drop_table(:hotels)
   -> 0.2900s
== TbHotel: reverted (0.3000s)
================================================

=> nil
>> TbHotel.up
== TbHotel: migrating
=========================================================
-- create_table(:hotels)
   -> 0.1000s
== TbHotel: migrated (0.1000s)
================================================

=> nil
>> require 'db/migrate/001_tb_hotel.rb'
=> false
>>
Austin Z. (Guest)
on 2006-04-27 16:40
(Received via mailing list)
On 4/27/06, Tuka O. <removed_email_address@domain.invalid> wrote:
> Hi,
>
> after making changes to a particular file,
> I would either like to overwrite the already included one or 'unrequire'
> the existing one. Is this possible ?

ri Kernel#load

-austin
Vincent I. (Guest)
on 2006-04-27 16:53
(Received via mailing list)
Hi,

> > after making changes to a particular file,
> > I would either like to overwrite the already included one or 'unrequire'
> > the existing one. Is this possible ?
> ri Kernel#load

Well, you could also remove the file from the array $", and rerequire
it, but I would not recommend it ;).
($" contains the list of the files loaded with 'require' and is used
to check that a file is not loaded twice)

Cheers,
Vincent ISAMBART
Tuka O. (Guest)
on 2006-04-27 20:15
many thanks for your input.

Worked great
Tuka
This topic is locked and can not be replied to.