Sha256: a6450029271a1254be085df5645153b9bc7f820d2af86174ac119906af1b040c

Contents?: true

Size: 769 Bytes

Versions: 24

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  class Backtrace
    module InspectResult
      module_function

      def inspect_result(obj)
        case obj
        when Hash
          "{" +
            obj.map do |key, val|
              "#{key}: #{inspect_truncated(val)}"
            end.join(", ") +
            "}"
        when Array
          "[" +
            obj.map { |v| inspect_truncated(v) }.join(", ") +
            "]"
        else
          inspect_truncated(obj)
        end
      end

      def inspect_truncated(obj)
        case obj
        when Hash
          "{...}"
        when Array
          "[...]"
        when GraphQL::Execution::Lazy
          "(unresolved)"
        else
          "#{obj.inspect}"
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
graphql-2.4.4 lib/graphql/backtrace/inspect_result.rb
graphql-2.4.3 lib/graphql/backtrace/inspect_result.rb
graphql-2.4.2 lib/graphql/backtrace/inspect_result.rb
graphql-2.4.1 lib/graphql/backtrace/inspect_result.rb
graphql-2.4.0 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.20 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.19 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.18 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.17 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.16 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.15 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.14 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.13 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.12 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.11 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.10 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.9 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.8 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.7 lib/graphql/backtrace/inspect_result.rb
graphql-2.3.6 lib/graphql/backtrace/inspect_result.rb