Skip to content

Instantly share code, notes, and snippets.

@shugo
Created December 16, 2019 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shugo/14e65da37582593064b0f33d63b71cce to your computer and use it in GitHub Desktop.
Save shugo/14e65da37582593064b0f33d63b71cce to your computer and use it in GitHub Desktop.
t.rb
module M
refine String do
def foo
puts "foo"
end
end
end
def bar(&block)
block.using(M)
block.call #=> foo
yield #=> NoMethodError expected, but foo
end
bar do
"x".foo
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment