Class: Break::IRB::Frontend
- Inherits:
-
Object
- Object
- Break::IRB::Frontend
- Defined in:
- lib/break/irb/frontend.rb
Instance Method Summary collapse
- #attach(session) ⇒ Object
- #detach ⇒ Object
-
#initialize ⇒ Frontend
constructor
A new instance of Frontend.
- #notify(message) ⇒ Object
- #where ⇒ Object
Constructor Details
#initialize ⇒ Frontend
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 |
#detach ⇒ Object
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() puts end |
#where ⇒ Object
26 27 28 |
# File 'lib/break/irb/frontend.rb', line 26 def where puts @workspace.code_around_binding if @workspace end |