Skip to content

Instantly share code, notes, and snippets.

View Shinpeim's full-sized avatar

Shinpei Maruyama Shinpeim

View GitHub Profile
class Nyan
def replace_method(a, b)
(class << self; self end).module_exec do
alias_method "#{a}_backup", a
alias_method "#{b}_backup", b
alias_method b, "#{a}_backup"
alias_method a, "#{b}_backup"
end
end