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.



118
119
120
121
122
123
124
# File 'lib/spoom/sorbet/errors.rb', line 118

def initialize(file, line, message, code, more = [])
  @file = file
  @line = line
  @message = message
  @code = code
  @more = more
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



104
105
106
# File 'lib/spoom/sorbet/errors.rb', line 104

def code
  @code
end

#fileObject (readonly)

Returns the value of attribute file.



101
102
103
# File 'lib/spoom/sorbet/errors.rb', line 101

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line.



104
105
106
# File 'lib/spoom/sorbet/errors.rb', line 104

def line
  @line
end

#messageObject (readonly)

Returns the value of attribute message.



101
102
103
# File 'lib/spoom/sorbet/errors.rb', line 101

def message
  @message
end

#moreObject (readonly)

Returns the value of attribute more.



107
108
109
# File 'lib/spoom/sorbet/errors.rb', line 107

def more
  @more
end

Instance Method Details

#<=>(other) ⇒ Object



127
128
129
130
# File 'lib/spoom/sorbet/errors.rb', line 127

def <=>(other)
  return 0 unless other.is_a?(Error)
  [file, line, code, message] <=> [other.file, other.line, other.code, other.message]
end

#to_sObject



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

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