-
-
Save hanachin/1c2a564095bd67952f9dd49ebfaa1a86 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'with_refinements' | |
module Ext | |
refine Integer do | |
def asdjflk | |
"ujihisa #{self}" | |
end | |
end | |
end | |
class C | |
using WithRefinements | |
def x | |
123 | |
end | |
def f | |
x = 234 | |
p x() #=> 123 | |
with_refinements(Ext) do | |
p x().asdjflk #=> "ujihisa 123" | |
p binding.local_variable_get(:x).asdjflk #=> "ujihisa 234" | |
end | |
end | |
end | |
puts '----------------------' | |
C.new.f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment