Skip to content

Instantly share code, notes, and snippets.

@GBH
Last active December 27, 2015 04:59
Show Gist options
  • Save GBH/7270563 to your computer and use it in GitHub Desktop.
Save GBH/7270563 to your computer and use it in GitHub Desktop.
class Foo
def bar
baz = 'something'
baz + what_with_context(:something)
end
end
module Wat
def what_with_context(id)
instance_exec(&Huh.some_method)
end
end
module Huh
def self.some_method
lambda do
" +++ #{baz} +++ "
end
end
end
Foo.send(:include, Wat)
foo = Foo.new
puts foo.bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment