Module: AssetLibrary::Compiler
- Defined in:
- lib/asset_library/compiler.rb,
lib/asset_library/compiler/base.rb,
lib/asset_library/compiler/closure.rb,
lib/asset_library/compiler/default.rb
Defined Under Namespace
Classes: Base, Closure, Default
Constant Summary collapse
- Error =
Class.new(RuntimeError)
Class Method Summary collapse
-
.create(type, config = {}) ⇒ Object
Create an instance of a compiler for the given compiler type.
-
.register(type, klass) ⇒ Object
Register a custom compiler class.
- .reset! ⇒ Object
Class Method Details
.create(type, config = {}) ⇒ Object
Create an instance of a compiler for the given compiler type.
11 12 13 14 |
# File 'lib/asset_library/compiler.rb', line 11 def create(type, config={}) klass = compiler_classes[type] ||= built_in_class_for(type) klass.new(config) end |
.register(type, klass) ⇒ Object
Register a custom compiler class.
17 18 19 |
# File 'lib/asset_library/compiler.rb', line 17 def register(type, klass) compiler_classes[type] = klass end |
.reset! ⇒ Object
21 22 23 |
# File 'lib/asset_library/compiler.rb', line 21 def reset! compiler_classes.clear end |