class FlammarionRepl

Public Class Methods

new() click to toggle source
# File bin/flammarion-repl, line 9
def initialize
  @f = Flammarion::Engraving.new(exit_on_disconnect:true)
  @f.subpane("output")
  @f.input("> ", autoclear:true, history:true) {|msg| repl(msg['text']) }
end

Public Instance Methods

puts(str) click to toggle source
# File bin/flammarion-repl, line 26
def puts(str)
  @f.subpane("output").puts "#{str}"
end
repl(str) click to toggle source
# File bin/flammarion-repl, line 15
def repl(str)
  @f.subpane("output").puts "> #{str}"
  result =
    begin
      eval(str).to_s.green
    rescue Exception => e
      "#{e}".red
    end
  @f.subpane("output").puts result
end