Class: Rubocop::ProcessedSource
- Inherits:
-
Object
- Object
- Rubocop::ProcessedSource
- Defined in:
- lib/rubocop/processed_source.rb
Overview
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.
Instance Attribute Summary collapse
-
#ast ⇒ Object
readonly
Returns the value of attribute ast.
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#diagnostics ⇒ Object
readonly
Returns the value of attribute diagnostics.
-
#disabled_lines_for_cops ⇒ Object
Returns the value of attribute disabled_lines_for_cops.
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Instance Method Summary collapse
- #[](*args) ⇒ Object
-
#initialize(buffer, ast, comments, tokens, diagnostics) ⇒ ProcessedSource
constructor
A new instance of ProcessedSource.
- #lines ⇒ Object
Constructor Details
#initialize(buffer, ast, comments, tokens, diagnostics) ⇒ ProcessedSource
Returns a new instance of ProcessedSource.
11 12 13 14 15 16 17 |
# File 'lib/rubocop/processed_source.rb', line 11 def initialize(buffer, ast, comments, tokens, diagnostics) @buffer = buffer @ast = ast @comments = comments @tokens = tokens @diagnostics = diagnostics end |
Instance Attribute Details
#ast ⇒ Object (readonly)
Returns the value of attribute ast.
8 9 10 |
# File 'lib/rubocop/processed_source.rb', line 8 def ast @ast end |
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
8 9 10 |
# File 'lib/rubocop/processed_source.rb', line 8 def buffer @buffer end |
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
8 9 10 |
# File 'lib/rubocop/processed_source.rb', line 8 def comments @comments end |
#diagnostics ⇒ Object (readonly)
Returns the value of attribute diagnostics.
8 9 10 |
# File 'lib/rubocop/processed_source.rb', line 8 def diagnostics @diagnostics end |
#disabled_lines_for_cops ⇒ Object
Returns the value of attribute disabled_lines_for_cops.
9 10 11 |
# File 'lib/rubocop/processed_source.rb', line 9 def disabled_lines_for_cops @disabled_lines_for_cops end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
8 9 10 |
# File 'lib/rubocop/processed_source.rb', line 8 def tokens @tokens end |
Instance Method Details
#[](*args) ⇒ Object
23 24 25 |
# File 'lib/rubocop/processed_source.rb', line 23 def [](*args) lines[*args] end |
#lines ⇒ Object
19 20 21 |
# File 'lib/rubocop/processed_source.rb', line 19 def lines @lines ||= @buffer.source.split($RS) end |