Class: Sanford::Nm::TemplateEngine

Inherits:
TemplateEngine
  • Object
show all
Defined in:
lib/sanford-nm.rb

Constant Summary collapse

DEFAULT_HANDLER_LOCAL =
'view'.freeze
DEFAULT_LOGGER_LOCAL =
'logger'.freeze

Instance Method Summary collapse

Instance Method Details

#nm_handler_localObject



20
21
22
# File 'lib/sanford-nm.rb', line 20

def nm_handler_local
  @nm_handler_local ||= (self.opts['handler_local'] || DEFAULT_HANDLER_LOCAL)
end

#nm_logger_localObject



24
25
26
# File 'lib/sanford-nm.rb', line 24

def nm_logger_local
  @nm_logger_local ||= (self.opts['logger_local'] || DEFAULT_LOGGER_LOCAL)
end

#nm_sourceObject



12
13
14
15
16
17
18
# File 'lib/sanford-nm.rb', line 12

def nm_source
  @nm_source ||= Nm::Source.new(self.source_path, {
    :cache  => self.opts['cache'],
    :ext    => self.opts['ext'],
    :locals => { self.nm_logger_local => self.logger }
  })
end

#partial(path, locals) ⇒ Object



32
33
34
# File 'lib/sanford-nm.rb', line 32

def partial(path, locals)
  self.nm_source.partial(path, locals)
end

#render(path, service_handler, locals) ⇒ Object



28
29
30
# File 'lib/sanford-nm.rb', line 28

def render(path, service_handler, locals)
  self.nm_source.render(path, render_locals(service_handler, locals))
end