Class: Relaton::Registry

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/relaton/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



12
13
14
# File 'lib/relaton/registry.rb', line 12

def initialize
  @processors = {}
end

Instance Attribute Details

#processorsObject (readonly)

Returns the value of attribute processors.



10
11
12
# File 'lib/relaton/registry.rb', line 10

def processors
  @processors
end

Instance Method Details

#find_processor(short) ⇒ Object



23
24
25
# File 'lib/relaton/registry.rb', line 23

def find_processor(short)
  @processors[short.to_sym]
end

#register(processor) ⇒ Object

Raises:



16
17
18
19
20
21
# File 'lib/relaton/registry.rb', line 16

def register(processor)
  raise Error unless processor < :: Relaton::Processor
  p = processor.new
  puts "[relaton] processor \"#{p.short}\" registered"
  @processors[p.short] = p
end

#supported_processorsObject



27
28
29
# File 'lib/relaton/registry.rb', line 27

def supported_processors
  @processors.keys
end