Sha256: 93dd1038f0a629bfc4d33f521902e22bea95de2541cdf6a1da2c85509fe8e047

Contents?: true

Size: 558 Bytes

Versions: 2

Compression:

Stored size: 558 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Yogurt
  class Query
    extend T::Sig
    extend T::Helpers
    abstract!

    sig {params(result: OBJECT_TYPE).returns(T.any(T.attached_class, Yogurt::ErrorResult::OnlyErrors))}
    def self.from_result(result)
      data = result['data']
      if data
        new(data, result['errors'])
      else
        Yogurt::ErrorResult::OnlyErrors.new(result['errors'])
      end
    end

    sig {params(data: OBJECT_TYPE, errors: T.nilable(OBJECT_TYPE)).void}
    def initialize(data, errors); end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yogurt-0.2.0 lib/yogurt/query.rb
yogurt-0.1.1 lib/yogurt/query.rb