Class: GryphonNest::Processors::ProcessorRegistry
- Inherits:
-
Object
- Object
- GryphonNest::Processors::ProcessorRegistry
- Defined in:
- lib/gryphon_nest/processors/processor_registry.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize {|_self| ... } ⇒ ProcessorRegistry
constructor
A new instance of ProcessorRegistry.
Constructor Details
#initialize {|_self| ... } ⇒ ProcessorRegistry
Returns a new instance of ProcessorRegistry.
6 7 8 9 10 |
# File 'lib/gryphon_nest/processors/processor_registry.rb', line 6 def initialize @asset_processor = AssetProcessor.new @processors = Hash.new(@asset_processor) yield self end |
Instance Method Details
#[](key) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gryphon_nest/processors/processor_registry.rb', line 20 def [](key) processor = @processors[key] if processor.is_a?(Proc) processor = processor.call @processors[key] = processor end processor rescue LoadError @processors.delete(key) @asset_processor end |
#[]=(key, value) ⇒ Object
14 15 16 |
# File 'lib/gryphon_nest/processors/processor_registry.rb', line 14 def []=(key, value) @processors[key] = value end |