Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

A replacement for Ruby's File.join (See related posts)

File.join is ugly, there I've said it. So how about being able to replace this:

require File.join(LOAD_PATH, 'foobar')


With this:

require LOAD_PATH/:foobar


Trivial, really:

class String
  def /(o)
    File.join(self, o.to_s)
  end
end

Comments on this post

nicwilliams posts on Aug 20, 2006 at 10:10
That's brilliant! I love changing the language :)

You need to create an account or log in to post comments to this site.


Click here to browse all 5147 code snippets

Related Posts