class HamlLint::Adapter::Haml5

Adapts the Haml::Parser from Haml 5 for use in HamlLint :reek: UncommunicativeModuleName

Attributes

parser[R]

The Haml parser to adapt for HamlLint

@api private @return [Haml::Parser] the Haml 4 parser

source[R]

The Haml code to parse

@api private @return [String] Haml code to parse

Public Class Methods

new(source, options = Haml::Options.new) click to toggle source

Parses the specified Haml code into an abstract syntax tree

@example

HamlLint::Adapter::Haml5.new('%div')

@api public @param source [String] Haml code to parse @param options [Haml::Options]

# File lib/haml_lint/adapter/haml_5.rb, line 16
def initialize(source, options = Haml::Options.new)
  @source = source
  @parser = Haml::Parser.new(options)
end

Public Instance Methods

parse() click to toggle source

Parses the source code into an abstract syntax tree

@example

HamlLint::Adapter::Haml5.new('%div').parse

@api public @return [Haml::Parser::ParseNode] @raise [Haml::Error]

# File lib/haml_lint/adapter/haml_5.rb, line 29
def parse
  parser.call(source)
end