Skip to content

Instantly share code, notes, and snippets.

@bodhi
Created March 14, 2012 06:57
Show Gist options
  • Save bodhi/2034753 to your computer and use it in GitHub Desktop.
Save bodhi/2034753 to your computer and use it in GitHub Desktop.
class A
def a; "A#a" end
module B
def b; "B#b" end
end
include B
end
module PatchA
def a; ["PatchedA#a", super].join ":" end
def b; ["PatchedA#b", super].join ":" end
end
A.send(:include, PatchA)
puts A.new.a # calls unpatched A#a
puts A.new.b # calls PatchA#b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment