Class: Braai::Template

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

Constant Summary

Constants included from Matchers

Matchers::ConditionalMatcher, Matchers::DefaultMatcher, Matchers::IterationMatcher, Matchers::RegionMatcher

Instance Attribute Summary collapse

Attributes included from Matchers

#fallback

Instance Method Summary collapse

Methods included from Matchers

add_fallback, clear!, map, matchers, reset!, set_defaults, unmap

Constructor Details

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

Returns a new instance of Template.



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

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

Instance Attribute Details

#templateObject

Returns the value of attribute template.



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

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(@template, self, attributes)
  context.render
end