Class: Hamli::Parser

Inherits:
Temple::Parser
  • Object
show all
Defined in:
lib/hamli/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(_options = {}) ⇒ Parser



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

def initialize(_options = {})
  super
  @file_path = options[:file] || '(__TEMPLATE__)'
end

Instance Method Details

#call(source) ⇒ Array



18
19
20
21
22
23
24
# File 'lib/hamli/parser.rb', line 18

def call(source)
  @stacks = [i[multi]]
  @indents = []
  @scanner = ::StringScanner.new(source)
  parse_block until @scanner.eos?
  @stacks[0]
end