Class: Tilt::Mapping
- Inherits:
-
Object
- Object
- Tilt::Mapping
- Defined in:
- lib/homura_vendor_tilt.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #extensions_for(engine_or_class) ⇒ Object
-
#initialize ⇒ Mapping
constructor
A new instance of Mapping.
- #register(template_class, *extensions) ⇒ Object
- #template_for(name) ⇒ Object
Constructor Details
#initialize ⇒ Mapping
Returns a new instance of Mapping.
21 22 23 |
# File 'lib/homura_vendor_tilt.rb', line 21 def initialize @extensions = {} end |
Instance Method Details
#[](name) ⇒ Object
29 30 31 |
# File 'lib/homura_vendor_tilt.rb', line 29 def [](name) @extensions[name.to_s] end |
#extensions_for(engine_or_class) ⇒ Object
33 34 35 36 37 |
# File 'lib/homura_vendor_tilt.rb', line 33 def extensions_for(engine_or_class) @extensions.each_with_object([]) do |(ext, klass), out| out << ext if klass == engine_or_class end end |
#register(template_class, *extensions) ⇒ Object
25 26 27 |
# File 'lib/homura_vendor_tilt.rb', line 25 def register(template_class, *extensions) extensions.each { |ext| @extensions[ext.to_s] = template_class } end |
#template_for(name) ⇒ Object
39 40 41 |
# File 'lib/homura_vendor_tilt.rb', line 39 def template_for(name) @extensions[name.to_s] end |