Class: Cutaneous::Compiler::ExtendedBlockSet

Inherits:
BlockSet
  • Object
show all
Defined in:
lib/cutaneous/compiler.rb

Overview

Represents the structure of a sub-template that inherits its block structure from some parent template defined by an ‘extends` tag.

Instance Attribute Summary

Attributes inherited from BlockSet

#current_block, #loader

Instance Method Summary collapse

Methods inherited from BlockSet

#block_end, #block_start, #each_block, #push, #to_script

Constructor Details

#initialize(template_name) ⇒ ExtendedBlockSet

Returns a new instance of ExtendedBlockSet.



86
87
88
89
# File 'lib/cutaneous/compiler.rb', line 86

def initialize(template_name)
  @super_template_name = template_name
  super()
end

Instance Method Details

#block(name) ⇒ Object



99
100
101
102
# File 'lib/cutaneous/compiler.rb', line 99

def block(name)
  return @block_store[name] if @block_store.key?(name)
  super_template.block(name)
end

#block_orderObject



104
105
106
# File 'lib/cutaneous/compiler.rb', line 104

def block_order
  super_template.block_order
end

#super_blockObject



95
96
97
# File 'lib/cutaneous/compiler.rb', line 95

def super_block
  super_template.block(current_block.name)
end

#super_templateObject



91
92
93
# File 'lib/cutaneous/compiler.rb', line 91

def super_template
  @super_template ||= @loader.template(@super_template_name)
end