Sha256: cdd95787897f2f810dccec0df6ff195539900e4ee7d9af069efd51fa957be214

Contents?: true

Size: 670 Bytes

Versions: 4

Compression:

Stored size: 670 Bytes

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
      @lines ||= @buffer.source.split($RS)
    end

    def [](*args)
      lines[*args]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.12.0 lib/rubocop/processed_source.rb
rubocop-0.11.1 lib/rubocop/processed_source.rb
rubocop-0.11.0 lib/rubocop/processed_source.rb
rubocop-0.10.0 lib/rubocop/processed_source.rb