Method: Scratch#run
- Defined in:
- lib/lem.rb
#run(text) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/lem.rb', line 38 def run(text) @lexer = ScratchLexer.new(text) @lexer.each do |word| word.upcase! if word.is_num? @stack.push word.to_f elsif @dictionary[word] @dictionary[word].call self else raise "Unknown word" end end end |