Class: EvaluateMath
- Inherits:
-
Object
- Object
- EvaluateMath
- Defined in:
- lib/ABCEvaluateMath/EvaluateMath.rb
Instance Method Summary collapse
-
#initialize ⇒ EvaluateMath
constructor
A new instance of EvaluateMath.
- #operation(a, b, ope) ⇒ Object
Constructor Details
#initialize ⇒ EvaluateMath
Returns a new instance of EvaluateMath.
10 11 12 13 14 15 |
# File 'lib/ABCEvaluateMath/EvaluateMath.rb', line 10 def initialize() @add = Add.new() @subtraction = Subtraction.new() @mult = Mult.new() @div = Div.new() end |
Instance Method Details
#operation(a, b, ope) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ABCEvaluateMath/EvaluateMath.rb', line 17 def operation(a, b, ope) case ope when "+" return @add.add(a, b) when "-" return @subtraction.subtraction(a, b) when "*" return @mult.mult(a, b) when "/" return @div.div(a, b) end end |