Created
January 20, 2018 09:48
-
-
Save pointcom/97b9fb8dd1c233f425534123c93d7a77 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
# This refinement will monkey patch the Integer#to_s method | |
# this change will be applied only in the current context | |
module IntegerRefinement | |
refine Integer do | |
def to_s | |
"this is an integer: #{super}" | |
end | |
end | |
end | |
using IntegerRefinement | |
puts 1.to_s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment