Class: Break::Pry::Frontend

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

Instance Method Summary collapse

Constructor Details

#initialize(pry) ⇒ Frontend

Returns a new instance of Frontend.



5
6
7
# File 'lib/break/pry/frontend.rb', line 5

def initialize(pry)
  @pry = pry
end

Instance Method Details

#attach(session) ⇒ Object



9
10
11
12
# File 'lib/break/pry/frontend.rb', line 9

def attach(session)
  @pry = Pry.start(session.context.binding)
  where
end

#detachObject



14
15
16
# File 'lib/break/pry/frontend.rb', line 14

def detach
  throw :breakout
end

#notify(message) ⇒ Object



24
25
26
# File 'lib/break/pry/frontend.rb', line 24

def notify(message)
  puts message
end

#whereObject



18
19
20
21
22
# File 'lib/break/pry/frontend.rb', line 18

def where
  @pry&.run_command "whereami".dup
rescue MethodSource::SourceNotFoundError
  puts "Cannot find method code."
end