Module: RailsRouteChecker::Parsers::HamlParser

Defined in:
lib/rails-route-checker/parsers/haml_parser.rb,
lib/rails-route-checker/parsers/haml_parser/document.rb,
lib/rails-route-checker/parsers/haml_parser/tree/node.rb,
lib/rails-route-checker/parsers/haml_parser/tree/tag_node.rb,
lib/rails-route-checker/parsers/haml_parser/ruby_extractor.rb,
lib/rails-route-checker/parsers/haml_parser/tree/root_node.rb,
lib/rails-route-checker/parsers/haml_parser/tree/filter_node.rb,
lib/rails-route-checker/parsers/haml_parser/tree/script_node.rb,
lib/rails-route-checker/parsers/haml_parser/tree/silent_script_node.rb

Defined Under Namespace

Modules: Tree Classes: Document, RubyExtractor

Class Method Summary collapse

Class Method Details

.run(filename, **opts) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rails-route-checker/parsers/haml_parser.rb', line 16

def run(filename, **opts)
  file_source = opts[:source] || File.read(filename)

  document = RailsRouteChecker::Parsers::HamlParser::Document.new(file_source)
  extracted_ruby = RailsRouteChecker::Parsers::HamlParser::RubyExtractor.extract(document)

  opts[:source] = extracted_ruby.source
  opts[:source_map] = extracted_ruby.source_map

  RailsRouteChecker::Parsers::RubyParser.run(filename, **opts)
end