Skip to content

Instantly share code, notes, and snippets.

@kmandreza
Created July 1, 2012 02:18
Show Gist options
  • Save kmandreza/3026513 to your computer and use it in GitHub Desktop.
Save kmandreza/3026513 to your computer and use it in GitHub Desktop.
Module
module Calculator
def add(num)
self + num
end
def subtract(num)
self - num
end
def multiply_by(num)
self * num
end
def divide_by(num)
result = self.to_f / num.to_f
end
end
class Numeric
include Calculator
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment