Module: Perspectives::Templating::ClassMethods

Defined in:
lib/perspectives/templating.rb

Instance Method Summary collapse

Instance Method Details

#_mustacheObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/perspectives/templating.rb', line 20

def _mustache
  return @_mustache if defined?(@_mustache)

  klass = self
  @_mustache = Class.new(Mustache) do
    self.template_name = klass.to_s.underscore
    self.raise_on_context_miss = klass.raise_on_context_miss?
    self.template_path = klass.template_path
  end
end

#_template_keyObject



31
32
33
34
35
36
# File 'lib/perspectives/templating.rb', line 31

def _template_key
  @_template_key ||=
    _mustache.template_file.
      sub(/^#{Regexp.escape(_mustache.template_path)}\//, '').
      chomp(".#{_mustache.template_extension}")
end

#raise_on_context_miss?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/perspectives/templating.rb', line 12

def raise_on_context_miss?
  Perspectives.raise_on_context_miss?
end

#template_pathObject



16
17
18
# File 'lib/perspectives/templating.rb', line 16

def template_path
  Perspectives.template_path
end