Module: MathTest

Defined in:
lib/math_test.rb,
lib/math_test/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.add(a, b, c) ⇒ Object

Your code goes here…



8
9
10
# File 'lib/math_test.rb', line 8

def self.add(a, b)
  a + b
end

.divide(a, b) ⇒ Object

Raises:

  • (ZeroDivisionError)


28
29
30
31
# File 'lib/math_test.rb', line 28

def self.divide(a, b)
  raise ZeroDivisionError, "Cannot divide by zero" if b == 0
  a.to_f / b
end

.multiply(a, b) ⇒ Object



24
25
26
# File 'lib/math_test.rb', line 24

def self.multiply(a, b)
  a * b
end

.subtract(a, b) ⇒ Object



20
21
22
# File 'lib/math_test.rb', line 20

def self.subtract(a, b)
  a - b
end

.sumsub(a, b, c) ⇒ Object



16
17
18
# File 'lib/math_test.rb', line 16

def self.sumsub(a, b, c)
  a + b - c
end