Skip to content

Instantly share code, notes, and snippets.

@patrickgombert
Created February 28, 2012 04:18
Show Gist options
  • Save patrickgombert/1929440 to your computer and use it in GitHub Desktop.
Save patrickgombert/1929440 to your computer and use it in GitHub Desktop.
Proc eval example
module Foo
class Bar
end
class Baz
def gen_bar
return Proc.new { Bar.new }
end
end
end
module Example
class Bar
def gen_bar
Foo::Baz.new.gen_bar.call()
end
end
end
Example::Bar.new.gen_bar # => <Foo::Bar>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment