Class: Spoom::Sorbet::Errors::Error

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Comparable
Defined in:
lib/spoom/sorbet/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, line, message, code, more = []) ⇒ Error

Returns a new instance of Error.



153
154
155
156
157
158
159
160
# File 'lib/spoom/sorbet/errors.rb', line 153

def initialize(file, line, message, code, more = [])
  @file = file
  @line = line
  @message = message
  @code = code
  @more = more
  @files_from_error_sections = T.let(Set.new, T::Set[String])
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



135
136
137
# File 'lib/spoom/sorbet/errors.rb', line 135

def code
  @code
end

#fileObject (readonly)

Returns the value of attribute file.



132
133
134
# File 'lib/spoom/sorbet/errors.rb', line 132

def file
  @file
end

#files_from_error_sectionsObject (readonly)

Returns the value of attribute files_from_error_sections.



142
143
144
# File 'lib/spoom/sorbet/errors.rb', line 142

def files_from_error_sections
  @files_from_error_sections
end

#lineObject (readonly)

Returns the value of attribute line.



135
136
137
# File 'lib/spoom/sorbet/errors.rb', line 135

def line
  @line
end

#messageObject (readonly)

Returns the value of attribute message.



132
133
134
# File 'lib/spoom/sorbet/errors.rb', line 132

def message
  @message
end

#moreObject (readonly)

Returns the value of attribute more.



138
139
140
# File 'lib/spoom/sorbet/errors.rb', line 138

def more
  @more
end

Instance Method Details

#<=>(other) ⇒ Object



164
165
166
167
168
# File 'lib/spoom/sorbet/errors.rb', line 164

def <=>(other)
  return 0 unless other.is_a?(Error)

  [file, line, code, message] <=> [other.file, other.line, other.code, other.message]
end

#to_sObject



171
172
173
# File 'lib/spoom/sorbet/errors.rb', line 171

def to_s
  "#{file}:#{line}: #{message} (#{code})"
end