Class: RuboCop::RBS::ProcessedRBSSource
- Inherits:
-
Object
- Object
- RuboCop::RBS::ProcessedRBSSource
- Defined in:
- lib/rubocop/rbs/processed_rbs_source.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#decls ⇒ Object
readonly
Returns the value of attribute decls.
-
#directives ⇒ Object
readonly
Returns the value of attribute directives.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#raw_source ⇒ Object
readonly
Returns the value of attribute raw_source.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(source) ⇒ ProcessedRBSSource
constructor
A new instance of ProcessedRBSSource.
- #tokens ⇒ Object
- #valid_syntax? ⇒ Boolean
Constructor Details
#initialize(source) ⇒ ProcessedRBSSource
Returns a new instance of ProcessedRBSSource.
13 14 15 16 17 18 19 20 |
# File 'lib/rubocop/rbs/processed_rbs_source.rb', line 13 def initialize(source) @raw_source = source.content @buffer, @directives, @decls = ::RBS::Parser.parse_signature(source) @error = nil @tokens = nil rescue ::RBS::ParsingError => e @error = e end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
8 9 10 |
# File 'lib/rubocop/rbs/processed_rbs_source.rb', line 8 def buffer @buffer end |
#decls ⇒ Object (readonly)
Returns the value of attribute decls.
10 11 12 |
# File 'lib/rubocop/rbs/processed_rbs_source.rb', line 10 def decls @decls end |
#directives ⇒ Object (readonly)
Returns the value of attribute directives.
9 10 11 |
# File 'lib/rubocop/rbs/processed_rbs_source.rb', line 9 def directives @directives end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
11 12 13 |
# File 'lib/rubocop/rbs/processed_rbs_source.rb', line 11 def error @error end |
#raw_source ⇒ Object (readonly)
Returns the value of attribute raw_source.
6 7 8 |
# File 'lib/rubocop/rbs/processed_rbs_source.rb', line 6 def raw_source @raw_source end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
7 8 9 |
# File 'lib/rubocop/rbs/processed_rbs_source.rb', line 7 def source @source end |
Instance Method Details
#tokens ⇒ Object
26 27 28 |
# File 'lib/rubocop/rbs/processed_rbs_source.rb', line 26 def tokens @tokens ||= ::RBS::Parser.lex(buffer).value end |
#valid_syntax? ⇒ Boolean
22 23 24 |
# File 'lib/rubocop/rbs/processed_rbs_source.rb', line 22 def valid_syntax? @error.nil? end |