Skip to content

Instantly share code, notes, and snippets.

@ignacy
Created December 25, 2010 11:03
Show Gist options
  • Save ignacy/754824 to your computer and use it in GitHub Desktop.
Save ignacy/754824 to your computer and use it in GitHub Desktop.
class A
class << self
def foo
puts "foo"
end
end
end
A.foo
class A
class << self
alias original_foo foo
def foo
puts "I say bar but only once.."
alias foo original_foo
end
end
end
A.foo
A.foo
# => foo
# => I say bar but only once..
# => foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment