Module: BetterHtml::BetterErb::RuntimeChecks

Included in:
ErubiImplementation
Defined in:
lib/better_html/better_erb/runtime_checks.rb

Instance Method Summary collapse

Instance Method Details

#initialize(erb, config: BetterHtml.config, **options) ⇒ Object



8
9
10
11
12
# File 'lib/better_html/better_erb/runtime_checks.rb', line 8

def initialize(erb, config: BetterHtml.config, **options)
  @parser = HtmlTokenizer::Parser.new
  @config = config
  super(erb, **options)
end

#validate!Object



14
15
16
17
18
19
20
# File 'lib/better_html/better_erb/runtime_checks.rb', line 14

def validate!
  check_parser_errors unless @config.disable_parser_validation

  unless @parser.context == :none
    raise BetterHtml::HtmlError, "Detected an open tag at the end of this document."
  end
end