Skip to content

Instantly share code, notes, and snippets.

@judofyr
Created March 30, 2010 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save judofyr/75ecb81a3ae98b097f8a to your computer and use it in GitHub Desktop.
Save judofyr/75ecb81a3ae98b097f8a to your computer and use it in GitHub Desktop.
Camping.goes :Example
Example.needs :Cool
def Camping.plugin(name)
file = caller.first[/^(.*?):(\d+): in/, 1]
@plugins[name] = IO.read(file)
end
def Camping.needs(name)
if code = @plugins[name]
eval(code.gsub("Cam\ping", "Camping"), TOPLEVEL_BINDING)
end
end
Camping.plugin :Cool
module Camping
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment