class ERBLint::ProcessedSource
Attributes
file_content[R]
filename[R]
parser[R]
Public Class Methods
new(filename, file_content)
click to toggle source
# File lib/erb_lint/processed_source.rb, line 7 def initialize(filename, file_content) @filename = filename @file_content = file_content @parser = BetterHtml::Parser.new(source_buffer, template_language: :html) end
Public Instance Methods
ast()
click to toggle source
# File lib/erb_lint/processed_source.rb, line 13 def ast @parser.ast end
source_buffer()
click to toggle source
# File lib/erb_lint/processed_source.rb, line 17 def source_buffer @source_buffer ||= begin buffer = Parser::Source::Buffer.new(filename) buffer.source = file_content buffer end end
to_source_range(range)
click to toggle source
# File lib/erb_lint/processed_source.rb, line 25 def to_source_range(range) range = (range.begin_pos...range.end_pos) if range.is_a?(::Parser::Source::Range) BetterHtml::Tokenizer::Location.new( source_buffer, range.begin, range.exclude_end? ? range.end : range.end + 1 ) end