Class: Hanami::View::Template
- Inherits:
-
Object
- Object
- Hanami::View::Template
- Defined in:
- gems/gems/hanami-view-1.3.3/lib/hanami/view/template.rb
Overview
A logic-less template.
Instance Method Summary collapse
-
#format ⇒ Symbol
Returns the format that the template handles.
-
#initialize(template, encoding = Encoding::UTF_8) ⇒ Template
constructor
A new instance of Template.
- #slim?(template) ⇒ Boolean private
Constructor Details
#initialize(template, encoding = Encoding::UTF_8) ⇒ Template
Returns a new instance of Template
Source: | on GitHub
def initialize(template, encoding = Encoding::UTF_8) = { default_encoding: encoding } if slim?(template) # NOTE disable_escape: true is for Slim compatibility # See https://github.com/hanami/assets/issues/36 [:disable_escape] = true end @_template = Tilt.new(template, nil, ) end |
Instance Method Details
#format ⇒ Symbol
Returns the format that the template handles.
Source: | on GitHub
def format @_template.basename.match(/\.([^.]+)/).captures.first.to_sym end |