Sha256: dde72048d7dd7b6dede8deb67dc8b19a80acd1ce2feb50ea442cb323e7733011
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 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, :comment_config def initialize(buffer, ast, comments, tokens, diagnostics) @buffer = buffer @ast = ast @comments = comments @tokens = tokens @diagnostics = diagnostics @comment_config = CommentConfig.new(self) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.19.1 | lib/rubocop/processed_source.rb |
rubocop-0.19.0 | lib/rubocop/processed_source.rb |