Class: Break::IRB::Frontend

Inherits:
Object
  • Object
show all
Defined in:
lib/break/irb/frontend.rb

Instance Method Summary collapse

Constructor Details

#initializeFrontend

Returns a new instance of Frontend.



7
8
9
# File 'lib/break/irb/frontend.rb', line 7

def initialize
  IRB.setup caller_locations.first.path, argv: []
end

Instance Method Details

#attach(session) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/break/irb/frontend.rb', line 11

def attach(session)
  @workspace = IRB::WorkSpace.new(session.context.binding)
  @irb = safely_build_irb_instance(session, @workspace)

  where

  @irb.suspend_context special_case_next_eval(@irb.context) do
    @irb.run(IRB.conf)
  end
end

#detachObject



22
23
24
# File 'lib/break/irb/frontend.rb', line 22

def detach
  @irb&.context&.exit
end

#notify(message) ⇒ Object



30
31
32
# File 'lib/break/irb/frontend.rb', line 30

def notify(message)
  puts message
end

#whereObject



26
27
28
# File 'lib/break/irb/frontend.rb', line 26

def where
  puts @workspace.code_around_binding if @workspace
end