Skip to content

Instantly share code, notes, and snippets.

@dyoder
Created April 25, 2009 23:11
Show Gist options
  • Save dyoder/101795 to your computer and use it in GitHub Desktop.
Save dyoder/101795 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'autocode'
class Object
include AutoCode
# fall back to creating a module that automatically loads
# from a directory of the snake-cased name, ex: Foo::Bar => 'foo/bar.rb'
auto_create_module true, Module.new do
auto_load true, :directory => lambda { self.class.name.snake_case }
end
# but first check to make sure 'foo.rb' isn't already there
auto_load true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment