Skip to content

Instantly share code, notes, and snippets.

@regedarek
Forked from LTe/gist:1710563
Created January 31, 2012 13:56
Show Gist options
  • Save regedarek/1710614 to your computer and use it in GitHub Desktop.
Save regedarek/1710614 to your computer and use it in GitHub Desktop.
module M
def method
puts "hello"
end
end
def execute(current_module, &block)
Object.new.tap do |o|
o.extend(current_module)
o.instance_eval &block
end
end
execute(M) do
method
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment