Sha256: 40520fb5520c8766313fab144fd932b023b30d3bce29771a836980817e093583
Contents?: true
Size: 1.03 KB
Versions: 7
Compression:
Stored size: 1.03 KB
Contents
# encoding: utf-8 module Rubocop # ProcessedSource contains objects which are generated by Parser # and other information such as disabled lines for cops. # It also provides a convenient way to access source lines. class ProcessedSource attr_reader :buffer, :ast, :comments, :tokens, :diagnostics attr_accessor :disabled_lines_for_cops def initialize(buffer, ast, comments, tokens, diagnostics) @buffer = buffer @ast = ast @comments = comments @tokens = tokens @diagnostics = diagnostics end def lines if @lines @lines else init_lines @lines end end def raw_lines if @raw_lines @raw_lines else init_lines @raw_lines end end def [](*args) lines[*args] end def valid_syntax? @diagnostics.none? { |d| [:error, :fatal].include?(d.level) } end private def init_lines @raw_lines = @buffer.source.lines @lines = @raw_lines.map(&:chomp) end end end
Version data entries
7 entries across 7 versions & 1 rubygems