Class: Braai::Template

Inherits:
Object
  • Object
show all
Extended by:
Matchers
Includes:
Matchers
Defined in:
lib/braai/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Matchers

clear!, map, matchers, reset!, unmap

Constructor Details

#initialize(template, matchers = {}) ⇒ Template

Returns a new instance of Template.



8
9
10
11
# File 'lib/braai/template.rb', line 8

def initialize(template, matchers = {})
  self.template = template
  @matchers = self.class.matchers.merge(matchers)
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



5
6
7
# File 'lib/braai/template.rb', line 5

def attributes
  @attributes
end

#templateObject

Returns the value of attribute template.



6
7
8
# File 'lib/braai/template.rb', line 6

def template
  @template
end

Instance Method Details

#render(attributes = {}) ⇒ Object



13
14
15
16
# File 'lib/braai/template.rb', line 13

def render(attributes = {})
  context = Braai::Context.new(self.template, self.matchers, attributes)
  context.render
end