Hi,

At Thu, 4 Aug 2005 21:46:06 +0900,
Trans wrote in [ruby-talk:150707]:
> How safe is this?

What do you mean by "safe"?

>   require 'uri'
> 
>   module Kernel
> 
>     alias_method :require_prefacets, :require
>     def require( *args )
>       require_esc( *args )
>     end
> 
>     def require_esc( fpath )
>       require_prefacets( File.join( File.dirname( fpath ), URI.escape( File.basename( fpath ), /\W/ ) ) )
>     end
> 
>   end

  $ irb -ruri
  irb(main):001:0> fpath = "foo.rb"
  => "foo.rb"
  irb(main):002:0> File.join(File.dirname(fpath), URI.escape(File.basename(fpath), /\W/))
  => "./foo%2Erb"

"foo.rb" and "./foo.rb" are diffrenet for `require', and it
doesn't load files have not suffix.

-- 
Nobu Nakada