Class: Kolom::REPL
- Inherits:
-
Object
- Object
- Kolom::REPL
- Defined in:
- lib/kolom/repl.rb
Instance Method Summary collapse
-
#initialize ⇒ REPL
constructor
A new instance of REPL.
- #start ⇒ Object
Constructor Details
#initialize ⇒ REPL
Returns a new instance of REPL.
6 7 8 |
# File 'lib/kolom/repl.rb', line 6 def initialize @interpreter = Interpreter.new end |
Instance Method Details
#start ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/kolom/repl.rb', line 10 def start loop do line = Readline.readline("কলম> ", true) break if line.nil? || line.strip == "বাহির" begin result, output = @interpreter.evaluate(line) puts output unless output.empty? puts "=> #{result.inspect}" unless result.nil? rescue => e puts "Error: #{e.}" puts e.backtrace.join("\n") end end puts "ধন্যবাদ!" end |