class BetterHtml::TestHelper::SafeErb::Base
Attributes
errors[R]
Public Class Methods
new(parser, config: BetterHtml.config)
click to toggle source
# File lib/better_html/test_helper/safe_erb/base.rb, line 12 def initialize(parser, config: BetterHtml.config) @parser = parser @config = config @errors = BetterHtml::Errors.new end
Public Instance Methods
add_error(message, location:)
click to toggle source
# File lib/better_html/test_helper/safe_erb/base.rb, line 18 def add_error(message, location:) @errors.add(SafetyError.new(message, location: location)) end
Protected Instance Methods
ast()
click to toggle source
# File lib/better_html/test_helper/safe_erb/base.rb, line 50 def ast @parser.ast end
erb_nodes(root_node)
click to toggle source
# File lib/better_html/test_helper/safe_erb/base.rb, line 24 def erb_nodes(root_node) Enumerator.new do |yielder| next if root_node.nil? root_node.descendants(:erb).each do |erb_node| indicator_node, _, code_node, _ = *erb_node yielder.yield(erb_node, indicator_node, code_node) end end end