Forum: Ruby Patching file class

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.
Daniel Völkerts (Guest)
on 2006-03-15 11:34
(Received via mailing list)
Hello,

I checked out the ruby cvs tree for me Windows Mobile issue. After I run
'nmake' I got a error for File.path(p) 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(p)
		File.new(p).path
	end
end

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

TIA,
Daniel Völkerts (Guest)
on 2006-03-15 11:37
(Received via mailing list)
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,
Curt H. (Guest)
on 2006-03-15 14:12
(Received via mailing list)
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
unknown (Guest)
on 2006-03-16 07:20
(Received via mailing list)
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.
This topic is locked and can not be replied to.