# Patching file class

**URL:** <https://www.ruby-forum.com/t/patching-file-class/82145>\
**Category:** Ruby\
**Created:** [March 15, 2006, 10:34am UTC](https://www.ruby-forum.com/t/patching-file-class/82145 "2006-03-15T10:34:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_VSSSSlkerts](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d26b3c/32.png) [@Daniel\_VSSSSlkerts](https://www.ruby-forum.com/u/Daniel_VSSSSlkerts)\
**Post date:** [March 15, 2006, 10:34am UTC](https://www.ruby-forum.com/t/patching-file-class/82145/1 "2006-03-15T10:34:13Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Daniel\_VSSSSlkerts](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d26b3c/32.png) [@Daniel\_VSSSSlkerts](https://www.ruby-forum.com/u/Daniel_VSSSSlkerts)\
**Post date:** [March 15, 2006, 10:37am UTC](https://www.ruby-forum.com/t/patching-file-class/82145/2 "2006-03-15T10:37:29Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Daniel\_VSSSSlkerts](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d26b3c/32.png) [@Daniel\_VSSSSlkerts](https://www.ruby-forum.com/u/Daniel_VSSSSlkerts)\
**Post date:** [March 15, 2006, 1:12pm UTC](https://www.ruby-forum.com/t/patching-file-class/82145/3 "2006-03-15T13:12:48Z")

</div>

On 3/15/06, Daniel Völkerts [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![Daniel\_VSSSSlkerts](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d26b3c/32.png) [@Daniel\_VSSSSlkerts](https://www.ruby-forum.com/u/Daniel_VSSSSlkerts)\
**Post date:** [March 16, 2006, 6:20am UTC](https://www.ruby-forum.com/t/patching-file-class/82145/4 "2006-03-16T06:20:56Z")

</div>

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.
