Class: Spoom::Sorbet::Errors::Error
- Inherits:
-
Object
- Object
- Spoom::Sorbet::Errors::Error
- Includes:
- Comparable
- Defined in:
- lib/spoom/sorbet/errors.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
: Integer?.
-
#file ⇒ Object
readonly
: String?.
-
#files_from_error_sections ⇒ Object
readonly
Other files associated with the error : Set.
-
#line ⇒ Object
readonly
: Integer?.
-
#message ⇒ Object
readonly
: String?.
-
#more ⇒ Object
readonly
: Array.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
By default errors are sorted by location : (untyped other) -> Integer.
-
#initialize(file, line, message, code, more = []) ⇒ Error
constructor
: (String? file, Integer? line, String? message, Integer? code, ?Array more) -> void.
-
#to_s ⇒ Object
: -> String.
Constructor Details
#initialize(file, line, message, code, more = []) ⇒ Error
: (String? file, Integer? line, String? message, Integer? code, ?Array more) -> void
138 139 140 141 142 143 144 145 |
# File 'lib/spoom/sorbet/errors.rb', line 138 def initialize(file, line, , code, more = []) @file = file @line = line @message = @code = code @more = more @files_from_error_sections = T.let(Set.new, T::Set[String]) end |
Instance Attribute Details
#code ⇒ Object (readonly)
: Integer?
128 129 130 |
# File 'lib/spoom/sorbet/errors.rb', line 128 def code @code end |
#file ⇒ Object (readonly)
: String?
125 126 127 |
# File 'lib/spoom/sorbet/errors.rb', line 125 def file @file end |
#files_from_error_sections ⇒ Object (readonly)
Other files associated with the error : Set
135 136 137 |
# File 'lib/spoom/sorbet/errors.rb', line 135 def files_from_error_sections @files_from_error_sections end |
#line ⇒ Object (readonly)
: Integer?
128 129 130 |
# File 'lib/spoom/sorbet/errors.rb', line 128 def line @line end |
#message ⇒ Object (readonly)
: String?
125 126 127 |
# File 'lib/spoom/sorbet/errors.rb', line 125 def @message end |
#more ⇒ Object (readonly)
: Array
131 132 133 |
# File 'lib/spoom/sorbet/errors.rb', line 131 def more @more end |
Instance Method Details
#<=>(other) ⇒ Object
By default errors are sorted by location : (untyped other) -> Integer
149 150 151 152 153 |
# File 'lib/spoom/sorbet/errors.rb', line 149 def <=>(other) return 0 unless other.is_a?(Error) [file, line, code, ] <=> [other.file, other.line, other.code, other.] end |
#to_s ⇒ Object
: -> String
156 157 158 |
# File 'lib/spoom/sorbet/errors.rb', line 156 def to_s "#{file}:#{line}: #{} (#{code})" end |