Class: ForkBreak::BreakpointSetter

Inherits:
Object
  • Object
show all
Defined in:
lib/fork_break.rb

Instance Method Summary collapse

Constructor Details

#initialize(fork, debug = false) ⇒ BreakpointSetter

Returns a new instance of BreakpointSetter.



56
57
58
59
60
# File 'lib/fork_break.rb', line 56

def initialize(fork, debug = false)
  @fork = fork
  @next_breakpoint = :forkbreak_start
  @debug = debug
end

Instance Method Details

#<<(symbol) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/fork_break.rb', line 62

def <<(symbol)
  @fork.send_object(symbol)
  if symbol == @next_breakpoint
    @next_breakpoint = @fork.receive_object unless symbol == :forkbreak_end
    puts "#{@fork.pid} received #{@next_breakpoint}" if @debug
  end
end