Created
November 22, 2016 15:24
-
-
Save zverok/ae70b0ee0f58ff0e7939d807b60aebd2 to your computer and use it in GitHub Desktop.
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 Refinements | |
refine Object do | |
def derp | |
yield self | |
end | |
end | |
end | |
module A | |
using Refinements | |
def self.foo | |
'test'.derp { |s| '(' + s + ')' } | |
end | |
end | |
p A.foo | |
# jruby 9.1.6.0 (2.3.1) 2016-11-22 0150a76 OpenJDK Server VM 24.65-b04 on 1.7.0_65-b32 +jit [linux-i386] | |
# NoMethodError: undefined method `derp' for "test":String | |
# foo at tmp/ref.rb:13 | |
# <main> at tmp/ref.rb:17 | |
# | |
# ruby 2.3.1 | |
# => "(test)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment