Module: NREPL

Defined in:
lib/nrepl-lazuli.rb,
lib/nrepl-lazuli/server.rb,
lib/nrepl-lazuli/connection.rb,
lib/nrepl-lazuli/fake_stdout.rb

Defined Under Namespace

Modules: DefinitionFixer, MethodLocationFixer, ThreadPatch Classes: Connection, FakeStdout, Server

Constant Summary collapse

VERSION =
'0.1.0'
DEFAULT_PORT =
7888
DEFAULT_HOST =
'127.0.0.1'
PORT_FILENAME =
'.nrepl-port'
@@bindings =
{}
@@connections =
Set.new

Class Method Summary collapse

Class Method Details

.watch!(binding, id = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/nrepl-lazuli.rb', line 13

def self.watch!(binding, id=nil)
  loc = caller_locations[0]
  file = loc.absolute_path
  row = loc.lineno
  id ||= "#{file}:#{row}"

  @@bindings[file] ||= {}
  @@bindings[file][loc.lineno-1] = {id: id, binding: binding}

  @@connections.each do |connection|
    connection.send_msg(
      'op' => 'hit_watch',
      'id' => id,
      'file' => file,
      'line' => row,
      'status' => ['done']
    )
  end
  nil
end