Class: Metanorma::Registry
- Inherits:
-
Object
- Object
- Metanorma::Registry
- Includes:
- Singleton
- Defined in:
- lib/metanorma/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.
- #output_formats ⇒ Object
- #register(processor) ⇒ Object
- #supported_backends ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
15 16 17 |
# File 'lib/metanorma/registry.rb', line 15 def initialize @processors = {} end |
Instance Attribute Details
#processors ⇒ Object (readonly)
Returns the value of attribute processors.
13 14 15 |
# File 'lib/metanorma/registry.rb', line 13 def processors @processors end |
Instance Method Details
#find_processor(short) ⇒ Object
26 27 28 |
# File 'lib/metanorma/registry.rb', line 26 def find_processor(short) @processors[short.to_sym] end |
#output_formats ⇒ Object
38 39 40 41 42 43 |
# File 'lib/metanorma/registry.rb', line 38 def output_formats @processors.inject({}) do |acc, (k,v)| acc[k] = v.output_formats acc end end |
#register(processor) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/metanorma/registry.rb', line 19 def register processor raise Error unless processor < ::Metanorma::Processor p = processor.new puts "[metanorma] processor \"#{p.short}\" registered" @processors[p.short] = p end |
#supported_backends ⇒ Object
30 31 32 |
# File 'lib/metanorma/registry.rb', line 30 def supported_backends @processors.keys end |