Class: LiquidLint::Filters::InjectLineNumbers
- Inherits:
-
Temple::Filter
- Object
- Temple::Filter
- LiquidLint::Filters::InjectLineNumbers
- Defined in:
- lib/liquid_lint/filters/inject_line_numbers.rb
Overview
Traverses a Temple S-expression (that has already been converted to Sexp instances) and annotates them with line numbers.
This is a hack that allows us to access line information directly from the S-expressions, which makes a lot of other tasks easier.
Constant Summary collapse
- NEWLINE_SEXP =
Sexp representing a newline.
LiquidLint::Sexp.new([:newline])
Instance Method Summary collapse
-
#call(sexp) ⇒ LiquidLint::Sexp
Annotates the given Sexp with line number information.
Instance Method Details
#call(sexp) ⇒ LiquidLint::Sexp
Annotates the given Sexp with line number information.
17 18 19 20 21 |
# File 'lib/liquid_lint/filters/inject_line_numbers.rb', line 17 def call(sexp) @line_number = 1 traverse(sexp) sexp end |