Module: HotCell::Registry

Defined in:
lib/hot_cell/registry.rb

Overview

The op field on the wire is looked up here. A name that arrived on the wire is never used to derive a constant, so the index only ever holds classes this cell already loaded.

Class Method Summary collapse

Class Method Details

.clearObject



30
31
32
33
# File 'lib/hot_cell/registry.rb', line 30

def clear
  @operations = []
  reload!
end

.lookup(name) ⇒ Object



22
23
24
# File 'lib/hot_cell/registry.rb', line 22

def lookup(name)
  index[name]
end

.namesObject



18
19
20
# File 'lib/hot_cell/registry.rb', line 18

def names
  index.keys.sort
end

.operationsObject



14
15
16
# File 'lib/hot_cell/registry.rb', line 14

def operations
  @operations ||= []
end

.register(operation) ⇒ Object



8
9
10
11
12
# File 'lib/hot_cell/registry.rb', line 8

def register(operation)
  operations << operation unless operations.include?(operation)
  reload!
  operation
end

.reload!Object



26
27
28
# File 'lib/hot_cell/registry.rb', line 26

def reload!
  @index = nil
end