Skip to content

Instantly share code, notes, and snippets.

@jokester
Forked from aligo/scope.rb
Created June 7, 2012 04:48
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 jokester/2886640 to your computer and use it in GitHub Desktop.
Save jokester/2886640 to your computer and use it in GitHub Desktop.
def def_scope(name, &block)
singleton_class.send(:define_method, name) do |*args|
klass = clone
block.call(klass, *args)
klass
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment