123456789_123456789_123456789_123456789_123456789_

Class: ActionView::HerbChecker

Do not use. This class is for internal use only.
Relationships & Source Files
Namespace Children
Classes:
Inherits: Object
Defined in: actionview/lib/action_view/herb_checker.rb

Class Method Summary

Class Method Details

.check(view_paths)

[ GitHub ]

  
# File 'actionview/lib/action_view/herb_checker.rb', line 11

def self.check(view_paths)
  handler = Template::Handlers::ERB.new

  view_paths.uniq.flat_map do |resolver|
    next [] unless resolver.respond_to?(:all_unbound_templates)

    unbound_templates = resolver.all_unbound_templates.select { |unbound|
      unbound.format == :html && unbound.handler == :erb
    }

    unbound_templates.filter_map { |unbound|
      template = unbound.bind_locals([])

      begin
        handler.call(template, template.source, implementation: Template::Handlers::ERB::Herb, validate_ruby: true)
        nil
      rescue ::Herb::Engine::CompilationError, ::Herb::Engine::SecurityError => error
        Failure.new(template, error)
      end
    }
  end
end