Class: Tokamak::Hook::Tilt::TokamakTemplate
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Tokamak::Hook::Tilt::TokamakTemplate
- Defined in:
- lib/tokamak/hook/tilt.rb
Instance Method Summary collapse
- #initialize_engine ⇒ Object
- #precompiled_postamble(locals) ⇒ Object
- #precompiled_preamble(locals) ⇒ Object
- #precompiled_template(locals) ⇒ Object
- #prepare ⇒ Object
Instance Method Details
#initialize_engine ⇒ Object
8 9 10 11 |
# File 'lib/tokamak/hook/tilt.rb', line 8 def initialize_engine return if defined?(::Tokamak) require_template_library 'tokamak' end |
#precompiled_postamble(locals) ⇒ Object
27 28 29 30 31 |
# File 'lib/tokamak/hook/tilt.rb', line 27 def precompiled_postamble(locals) <<-RUBY end RUBY end |
#precompiled_preamble(locals) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/tokamak/hook/tilt.rb', line 18 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
33 34 35 |
# File 'lib/tokamak/hook/tilt.rb', line 33 def precompiled_template(locals) data.to_str end |
#prepare ⇒ Object
13 14 15 16 |
# File 'lib/tokamak/hook/tilt.rb', line 13 def prepare @media_type = [:media_type] raise Tokamak::BuilderError.new("Content type required to build representation.") unless @media_type end |