Class: Sanford::TemplateEngine

Inherits:
Object
  • Object
show all
Defined in:
lib/sanford/template_engine.rb

Direct Known Subclasses

NullTemplateEngine

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = nil) ⇒ TemplateEngine

Returns a new instance of TemplateEngine.



10
11
12
13
14
# File 'lib/sanford/template_engine.rb', line 10

def initialize(opts = nil)
  @opts = opts || {}
  @source_path = Pathname.new(@opts['source_path'].to_s)
  @logger = @opts['logger'] || Sanford::NullLogger.new
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



8
9
10
# File 'lib/sanford/template_engine.rb', line 8

def logger
  @logger
end

#optsObject (readonly)

Returns the value of attribute opts.



8
9
10
# File 'lib/sanford/template_engine.rb', line 8

def opts
  @opts
end

#source_pathObject (readonly)

Returns the value of attribute source_path.



8
9
10
# File 'lib/sanford/template_engine.rb', line 8

def source_path
  @source_path
end

Instance Method Details

#==(other_engine) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/sanford/template_engine.rb', line 24

def ==(other_engine)
  if other_engine.kind_of?(TemplateEngine)
    self.source_path == other_engine.source_path &&
    self.opts        == other_engine.opts
  else
    super
  end
end

#partial(name, locals) ⇒ Object

Raises:

  • (NotImplementedError)


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

def partial(name, locals)
  raise NotImplementedError
end

#render(name, service_handler, locals) ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/sanford/template_engine.rb', line 16

def render(name, service_handler, locals)
  raise NotImplementedError
end