Class: Relaton::Registry
- Inherits:
-
Object
- Object
- Relaton::Registry
- Includes:
- Singleton
- Defined in:
- lib/relaton/registry.rb
Instance Attribute Summary collapse
-
#processors ⇒ Object
readonly
Returns the value of attribute processors.
Instance Method Summary collapse
- #find_processor(short) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #register(processor) ⇒ Object
- #supported_processors ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
12 13 14 |
# File 'lib/relaton/registry.rb', line 12 def initialize @processors = {} end |
Instance Attribute Details
#processors ⇒ Object (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
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_processors ⇒ Object
27 28 29 |
# File 'lib/relaton/registry.rb', line 27 def supported_processors @processors.keys end |