Created
December 16, 2019 09:00
-
-
Save shugo/14e65da37582593064b0f33d63b71cce to your computer and use it in GitHub Desktop.
t.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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