Module: Handlers

Extended by:
Handlers
Included in:
Handlers
Defined in:
lib/breakpoint_client.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#breakpoint_handler(workspace, message) ⇒ Object



87
88
89
90
91
92
93
94
95
# File 'lib/breakpoint_client.rb', line 87

def breakpoint_handler(workspace, message)
  puts message
  IRB.start(nil, nil, workspace)

  puts ""
  if Options[:Verbose] then
    puts "Resumed execution. Waiting for next breakpoint...", ""
  end
end

#collision_handlerObject



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/breakpoint_client.rb', line 106

def collision_handler()
  msg = [
    "  *** Breakpoint service collision ***",
    "  Another Breakpoint service tried to use the",
    "  port already occupied by this one. It will",
    "  keep waiting until this Breakpoint service",
    "  is shut down.",
    "  ",
    "  If you are using the Breakpoint library for",
    "  debugging a Rails or other CGI application",
    "  this likely means that this Breakpoint",
    "  session belongs to an earlier, outdated",
    "  request and should be shut down via 'exit'."
  ].join("\n")

  if RUBY_PLATFORM["win"] then
    # This sucks. Sorry, I'm not doing this because
    # I like funky message boxes -- I need to do this
    # because on Windows I have no way of displaying
    # my notification via puts() when gets() is still
    # being performed on STDIN. I have not found a
    # better solution.
    begin
      require 'tk'
      root = TkRoot.new { withdraw }
      Tk.messageBox('message' => msg, 'type' => 'ok')
      root.destroy
    rescue Exception
      puts "", msg, ""
    end
  else
    puts "", msg, ""
  end
end

#eval_handler(code) ⇒ Object



97
98
99
100
101
102
103
104
# File 'lib/breakpoint_client.rb', line 97

def eval_handler(code)
  result = eval(code, TOPLEVEL_BINDING)
  if result then
    DRbObject.new(result)
  else
    result
  end
end