Skip to content

Instantly share code, notes, and snippets.

@thinkerbot
Created November 5, 2011 22:08
Show Gist options
  • Save thinkerbot/1342089 to your computer and use it in GitHub Desktop.
Save thinkerbot/1342089 to your computer and use it in GitHub Desktop.
Access included modules on a BasicObject
class Basic < BasicObject
def _included_modules_
class << self
SINGLETON_CLASS = self
def _included_modules_
SINGLETON_CLASS.included_modules
end
end
_included_modules_
end
def extend(mod)
mod.__send__(:extend_object, self)
end
def clone
child = ::Basic.new
_included_modules_.each {|mod| child.extend mod }
child
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment