Class: HelloRubyCalculator::Calculator
- Inherits:
-
Object
- Object
- HelloRubyCalculator::Calculator
- Defined in:
- lib/hello_ruby_calculator/calculator.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Instance Method Summary collapse
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
3 4 5 |
# File 'lib/hello_ruby_calculator/calculator.rb', line 3 def args @args end |
Instance Method Details
#divide(*args) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/hello_ruby_calculator/calculator.rb', line 26 def divide *args @args = args validate_params args.reduce(:/) end |
#multiply(*args) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/hello_ruby_calculator/calculator.rb', line 19 def multiply *args @args = args validate_params args.reduce(:*) end |
#subtract(*args) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/hello_ruby_calculator/calculator.rb', line 12 def subtract *args @args = args validate_params args.reduce(:-) end |
#sum(*args) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/hello_ruby_calculator/calculator.rb', line 5 def sum *args @args = args validate_params args.reduce(:+) end |