/
haml_4.rb
40 lines (36 loc) · 1.02 KB
/
haml_4.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module HamlLint
class Adapter
# Adapts the Haml::Parser from Haml 4 for use in HamlLint
# :reek:UncommunicativeModuleName
class Haml4 < Adapter
extend Forwardable
# Parses the specified Haml code into an abstract syntax tree
#
# @example
# HamlLint::Adapter::Haml4.new('%div')
#
# @api public
# @param source [String] Haml code to parse
# @param options [Haml::Options]
def initialize(source, options = Haml::Options.new)
@parser = Haml::Parser.new(source, options)
end
# @!method
# Parses the source code into an abstract syntax tree
#
# @example
# HamlLint::Adapter::Haml4.new('%div')
#
# @api public
# @return [Haml::Parser::ParseNode]
# @raise [Haml::Error]
def_delegator :parser, :parse
private
# The Haml parser to adapt for HamlLint
#
# @api private
# @return [Haml::Parser] the Haml 4 parser
attr_reader :parser
end
end
end