Skip to content

Instantly share code, notes, and snippets.

@ksss
Created November 5, 2015 09:48
Show Gist options
  • Save ksss/0df7813c01e2689e6754 to your computer and use it in GitHub Desktop.
Save ksss/0df7813c01e2689e6754 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
module Hello
class World
def hi
"wow"
end
end
class Foo
def hi
World.new.hi
end
end
end
module ForceCall
refine Hello::World do
def hi
"hello"
end
end
end
using ForceCall
p Hello::Foo.new.hi #=> expect "hello" got "wow"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment