Class: Tokamak::Hook::Tilt::TokamakTemplate
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Tokamak::Hook::Tilt::TokamakTemplate
- Defined in:
- lib/tokamak/hook/tilt.rb
Class Method Summary collapse
Instance Method Summary collapse
- #initialize_engine ⇒ Object
- #precompiled_postamble(locals) ⇒ Object
- #precompiled_preamble(locals) ⇒ Object
- #precompiled_template(locals) ⇒ Object
- #prepare ⇒ Object
Class Method Details
.engine_initialized? ⇒ Boolean
12 13 14 |
# File 'lib/tokamak/hook/tilt.rb', line 12 def self.engine_initialized? defined? ::Tokamak end |
Instance Method Details
#initialize_engine ⇒ Object
8 9 10 |
# File 'lib/tokamak/hook/tilt.rb', line 8 def initialize_engine require_template_library 'tokamak' end |
#precompiled_postamble(locals) ⇒ Object
30 31 32 33 34 |
# File 'lib/tokamak/hook/tilt.rb', line 30 def precompiled_postamble(locals) <<-RUBY end RUBY end |
#precompiled_preamble(locals) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/tokamak/hook/tilt.rb', line 21 def precompiled_preamble(locals) local_assigns = super <<-RUBY begin extend ::Tokamak.builder_lookup(#{@media_type.inspect}).helper #{local_assigns} RUBY end |
#precompiled_template(locals) ⇒ Object
36 37 38 |
# File 'lib/tokamak/hook/tilt.rb', line 36 def precompiled_template(locals) data.to_str end |
#prepare ⇒ Object
16 17 18 19 |
# File 'lib/tokamak/hook/tilt.rb', line 16 def prepare @media_type = [:media_type] || @options[:media_type] raise Tokamak::BuilderError.new("Content type required to build representation.") unless @media_type end |