Class: RPNCalculator::Operation::Base
- Inherits:
-
Object
- Object
- RPNCalculator::Operation::Base
show all
- Defined in:
- lib/rpn-calculator/operation/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(operands) ⇒ Base
Returns a new instance of Base.
8
9
10
|
# File 'lib/rpn-calculator/operation/base.rb', line 8
def initialize(operands)
@operands = operands.compact
end
|
Class Method Details
.operate(operands) ⇒ Object
4
5
6
|
# File 'lib/rpn-calculator/operation/base.rb', line 4
def self.operate(operands)
new(operands).result
end
|
Instance Method Details
#result ⇒ Object
12
13
14
|
# File 'lib/rpn-calculator/operation/base.rb', line 12
def result
raise 'must implement in subclass'
end
|