Class: Insert
Constant Summary collapse
- REP =
'/'
Instance Method Summary collapse
Methods inherited from Op
#apply_monad_deep, #integer_args, #numeric_literal?, #to_numeric
Instance Method Details
#run(ary, interpreter) ⇒ Object
123 124 125 126 127 128 129 130 131 |
# File 'lib/jop.rb', line 123 def run ary, interpreter if interpreter.tokens[0] == Plus::REP interpreter.advance(1) box ary.reduce(&method(:add)) elsif interpreter.tokens[0] == Sign::REP interpreter.advance(1) box ary.reduce(:*) end end |