Created
August 7, 2015 05:37
-
-
Save hackling/0feab721cfa6f16865a1 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
class MyObject | |
include SquareMethod | |
def method | |
"#{square 4}" | |
end | |
end | |
module SquareMethod | |
def square(number) | |
number * number | |
end | |
end | |
#-------------------------- | |
class MyObject | |
using SquareMethod | |
def method | |
"#{4.square}" | |
end | |
end | |
module SquareMethod | |
refine Integer do | |
def square(number) | |
number * number | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment