Patching file class


#1

Hello,

I checked out the ruby cvs tree for me Windows Mobile issue. After I run
‘nmake’ I got a error for File.path§ NoMethodError as this method is
called by a argument (the path I guess).

My ruby 1.8.4 installation only knows File.path without a parameter. I
know that I can ‘patch’ ruby classes and I wrote following:

class File
def path§
File.new§.path
end
end

But where to put this fragement in? I don’t find any file.rb or io.rb.

TIA,


#2

In addition I saw that the method is implemented in Ruby 1.9. Is the cvs
version only compilable by the newest ruby snapshot? I’d like to use
my stable one-click-installer release.

Thanks,


#3

On 3/15/06, Daniel Völkerts removed_email_address@domain.invalid wrote:

   def path(p)
           File.new(p).path
   end

end

But where to put this fragement in? I don’t find any file.rb or io.rb.

You can put this anywhere in your own application. Ruby’s classes can
alwasy be reopened and modified – even system classes.

Curt


#4

Hi,

At Wed, 15 Mar 2006 18:35:32 +0900,
Daniel Völkerts wrote in [ruby-talk:184238]:

In addition I saw that the method is implemented in Ruby 1.9. Is the cvs
version only compilable by the newest ruby snapshot? I’d like to use
my stable one-click-installer release.

You have to use ruby_1_8 branch.