Class: FlavourSaver::Parser::Environment

Inherits:
RLTK::Parser::Environment
  • Object
show all
Defined in:
lib/flavour_saver/parser.rb

Instance Method Summary collapse

Instance Method Details

#blocksObject



22
23
24
# File 'lib/flavour_saver/parser.rb', line 22

def blocks
  @blocks ||= []
end

#pop_block(block) ⇒ Object



16
17
18
19
20
# File 'lib/flavour_saver/parser.rb', line 16

def pop_block block
  b = blocks.pop
  raise UnbalancedBlockError, "Unable to find matching opening for {{/#{block.name}}}" if b != block.name
  block
end

#push_block(block) ⇒ Object



11
12
13
14
# File 'lib/flavour_saver/parser.rb', line 11

def push_block block
  blocks.push(block.name)
  block
end