Class: Bemer::TemplateCatalog::Drawer

Inherits:
Object
  • Object
show all
Defined in:
lib/bemer/template_catalog/drawer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cached = false, &block) ⇒ Drawer

Returns a new instance of Drawer.



10
11
12
13
# File 'lib/bemer/template_catalog/drawer.rb', line 10

def initialize(cached = false, &block)
  @block  = block
  @cached = cached
end

Instance Attribute Details

#cachedObject (readonly) Also known as: cached?

Returns the value of attribute cached.



6
7
8
# File 'lib/bemer/template_catalog/drawer.rb', line 6

def cached
  @cached
end

Instance Method Details

#compiled_templatesObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/bemer/template_catalog/drawer.rb', line 15

def compiled_templates
  @compiled_templates ||= begin
    new_templates = []
    builder       = Builders::TemplateList.new(new_templates)

    block.binding.receiver.capture(builder, &block)

    new_templates
  end
end