Pretty version of Ruby's require statement?
require, ruby, ruby-on-rails
Solution
You can extend the kernel.
module Kernel
def require_relative(path)
require File.join(File.dirname(caller[0]), path.to_str)
end
end
Problem
I've always thought this sort of thing ugly: ``` require File.join(File.dirname(__FILE__), 'hirb/config') ``` Is there a prettier alternative, maybe one written for Rails? ``` require_relative 'hirb/config' require_relative '../another/file' ```