Class: HamlI18nLint::Linter
- Inherits:
-
Object
- Object
- HamlI18nLint::Linter
- Defined in:
- lib/haml_i18n_lint/linter.rb,
lib/haml_i18n_lint/linter/compiler_extension.rb
Overview
Linter linting a Haml template
Direct Known Subclasses
Defined Under Namespace
Modules: CompilerExtension Classes: AttributesParseError, Result, ResultSet
Instance Attribute Summary collapse
-
#filename ⇒ String
readonly
Name of the linted file.
-
#node ⇒ Haml::Parser::ParseNode
readonly
The node that needs i18n.
-
#text ⇒ String
readonly
The text that needs i18n.
Instance Method Summary collapse
-
#initialize(config) ⇒ Lint
constructor
New linter with given configuration.
-
#lint(filename:, template:) ⇒ Linter::ResultSet
Linting given template.
Constructor Details
#initialize(config) ⇒ Lint
Returns new linter with given configuration.
50 51 52 |
# File 'lib/haml_i18n_lint/linter.rb', line 50 def initialize(config) @config = config end |
Instance Attribute Details
#filename ⇒ String (readonly)
Returns name of the linted file.
|
|
# File 'lib/haml_i18n_lint/linter.rb', line 11
|
#node ⇒ Haml::Parser::ParseNode (readonly)
Returns the node that needs i18n.
|
|
# File 'lib/haml_i18n_lint/linter.rb', line 14
|
#text ⇒ String (readonly)
Returns the text that needs i18n.
|
|
# File 'lib/haml_i18n_lint/linter.rb', line 17
|
Instance Method Details
#lint(filename:, template:) ⇒ Linter::ResultSet
Linting given template
60 61 62 63 64 65 |
# File 'lib/haml_i18n_lint/linter.rb', line 60 def lint(filename:, template:) = ::Haml::Options.new [:filename] = filename node = parse(, template) compiler().compile(node) end |