Class: RubyJard::ReplProcessor

Inherits:
Byebug::CommandProcessor
  • Object
show all
Defined in:
lib/ruby_jard/repl_processor.rb

Overview

Byebug allows customizing processor with a series of hooks (github.com/deivid-rodriguez/byebug/blob/e1fb8209d56922f7bafd128af84e61568b6cd6a7/lib/byebug/processors/command_processor.rb)

This class is a bridge between REPL library and Byebug. It is inherited from Byebug::CommandProcessor, the processor is triggered. It starts draw the UI, starts a new REPL session, listen for control-flow events threw from repl, and triggers Byebug debugger if needed.

Instance Method Summary collapse

Constructor Details

#initialize(context, *args) ⇒ ReplProcessor

Returns a new instance of ReplProcessor.



26
27
28
29
30
31
32
33
34
# File 'lib/ruby_jard/repl_processor.rb', line 26

def initialize(context, *args)
  super(context, *args)
  @config = RubyJard.config
  @repl_proxy = RubyJard::ReplProxy.new(
    key_bindings: RubyJard.global_key_bindings
  )
  @previous_flow = RubyJard::ControlFlow.new(:next)
  @output = RubyJard::Console.output
end

Instance Method Details

#at_endObject



44
45
46
# File 'lib/ruby_jard/repl_processor.rb', line 44

def at_end
  process_commands_with_lock
end

#at_lineObject



36
37
38
# File 'lib/ruby_jard/repl_processor.rb', line 36

def at_line
  process_commands_with_lock
end

#at_return(_return_value) ⇒ Object



40
41
42
# File 'lib/ruby_jard/repl_processor.rb', line 40

def at_return(_return_value)
  process_commands_with_lock
end