Skip to content

Instantly share code, notes, and snippets.

@mirven
Created January 2, 2010 00:17
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 mirven/267314 to your computer and use it in GitHub Desktop.
Save mirven/267314 to your computer and use it in GitHub Desktop.
class Foo
end
animals = [ "cat", "dog" ]
foo = Foo.new
m = Module.new
m.send(:define_method, :bar) do
animals
end
foo.extend(m)
puts foo.bar.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment