Skip to content

Instantly share code, notes, and snippets.

@Mon-Ouie
Created April 20, 2013 11:27
Show Gist options
  • Save Mon-Ouie/5425680 to your computer and use it in GitHub Desktop.
Save Mon-Ouie/5425680 to your computer and use it in GitHub Desktop.
class Module
def around_module
unless defined? @around_module
prepend (@around_module = Module.new)
end
@around_module
end
def around(&block)
around_module.class_eval(&block)
end
end
class String
around do
def reverse
puts "before reversing"
super
end
end
end
puts "hi".reverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment