lib/spoom/sorbet/lsp/errors.rb in spoom-1.1.11 vs lib/spoom/sorbet/lsp/errors.rb in spoom-1.1.12

- old
+ new

@@ -14,50 +14,56 @@ attr_reader :uri sig { returns(T::Array[Diagnostic]) } attr_reader :diagnostics - sig { params(json: T::Hash[T.untyped, T.untyped]).returns(Diagnostics) } - def self.from_json(json) - Diagnostics.new( - json['uri'], - json['diagnostics'].map { |d| Diagnostic.from_json(d) } - ) + class << self + extend T::Sig + + sig { params(json: T::Hash[T.untyped, T.untyped]).returns(Diagnostics) } + def from_json(json) + Diagnostics.new( + json["uri"], + json["diagnostics"].map { |d| Diagnostic.from_json(d) } + ) + end end sig { params(uri: String, diagnostics: T::Array[Diagnostic]).void } def initialize(uri, diagnostics) @uri = uri @diagnostics = diagnostics + super() end end end class ResponseError < Error extend T::Sig sig { returns(Integer) } attr_reader :code - sig { returns(String) } - attr_reader :message - sig { returns(T::Hash[T.untyped, T.untyped]) } attr_reader :data - sig { params(json: T::Hash[T.untyped, T.untyped]).returns(ResponseError) } - def self.from_json(json) - ResponseError.new( - json['code'], - json['message'], - json['data'] - ) + class << self + extend T::Sig + + sig { params(json: T::Hash[T.untyped, T.untyped]).returns(ResponseError) } + def from_json(json) + ResponseError.new( + json["code"], + json["message"], + json["data"] + ) + end end sig { params(code: Integer, message: String, data: T::Hash[T.untyped, T.untyped]).void } def initialize(code, message, data) + super(message) @code = code - @message = message @data = data end end end end