Last active
May 21, 2020 04:45
-
-
Save IvanDerlich/28fd6c8bb35e2c134460a6acf0e66672 to your computer and use it in GitHub Desktop.
Gist created for Rspec Article. Published first in medium.
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
class Calculator | |
def addition a,b | |
a + b | |
end | |
def substraction a,b | |
a - b | |
end | |
def multiplication a,b | |
a * b | |
end | |
def division a,b | |
return "Indeterminate" if b==0 && a==0 | |
return "Positive Infinity" if b == 0 && a > 0 | |
return "Negative Infinity" if b == 0 && a < 0 | |
(a / b.to_f) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment