class Lingo::Attendee::Debugger

Public Instance Methods

control(cmd, param = nil, *) click to toggle source
# File lib/lingo/attendee/debugger.rb, line 107
def control(cmd, param = nil, *)
  if @cmd_eval
    debug(eval(@cmd_eval)) { "*#{cmd}('#{param}')" }
  elsif cmd == :EOL
    :skip_command
  end
end
init(default_prompt = 'lex:) ') click to toggle source
# File lib/lingo/attendee/debugger.rb, line 94
def init(default_prompt = 'lex:) ')
  @prompt = get_key('prompt', default_prompt)

  unless @filter ||= get_key('filter', false)
    @cmd_eval = get_key('ceval', 'true')
  else
    @cmd_eval = nil
  end

  @obj_eval = get_key('eval', 'true')
  @preamble = get_key('preamble', true)
end
process(obj, *) click to toggle source
# File lib/lingo/attendee/debugger.rb, line 115
def process(obj, *)
  debug(eval(@obj_eval)) { obj.inspect }
  forward(obj) unless @filter
end

Private Instance Methods

debug(condition) { || ... } click to toggle source
# File lib/lingo/attendee/debugger.rb, line 122
def debug(condition)
  send_msg((@preamble = nil; @lingo.config.to_h.to_yaml)) if @preamble
  send_msg(@prompt + yield) if condition
end
send_msg(msg) click to toggle source
# File lib/lingo/attendee/debugger.rb, line 127
def send_msg(msg)
  @filter ? forward(msg) : warn(msg)
end