Skip to content

Instantly share code, notes, and snippets.

@ujihisa
Created July 31, 2018 12:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ujihisa/00de41babf4f536263037b3910381c72 to your computer and use it in GitHub Desktop.
Save ujihisa/00de41babf4f536263037b3910381c72 to your computer and use it in GitHub Desktop.
require 'sin_refinements'
module Ext
refine Integer do
def asdjflk
"ujihisa #{self}"
end
end
end
class C
def x
123
end
def f
x = 234
p x() #=> 123
SinRefinements.refining(Ext) do
p x().asdjflk #=> "ujihisa 234"
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