Skip to content

Instantly share code, notes, and snippets.

@zmack
Created March 10, 2010 11:08
Show Gist options
  • Save zmack/327767 to your computer and use it in GitHub Desktop.
Save zmack/327767 to your computer and use it in GitHub Desktop.
class Foo
def self.bar
"bar"
end
end
p Foo.bar # => "bar"
# in Rails-type stuff you can use Foo.metaclass
(class << Foo; self; end).send(:define_method, :bar) do
"baz"
end
p Foo.bar # => "baz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment