Sha256: dbbb711e06bcf8a6b85c2a29e0257d815d109e482bddfc5bf39d81d093761291

Contents?: true

Size: 589 Bytes

Versions: 112

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  module Dig
    # implemented using the old activesupport #dig instead of the ruby built-in
    # so we can use some of the magic in Schema::InputObject and Query::Arguments
    # to handle stringified/symbolized keys.
    #
    # @param args [Array<[String, Symbol>] Retrieves the value object corresponding to the each key objects repeatedly
    # @return [Object]
    def dig(own_key, *rest_keys)
      val = self[own_key]
      if val.nil? || rest_keys.empty?
        val
      else
        val.dig(*rest_keys)
      end
    end
  end
end

Version data entries

112 entries across 112 versions & 2 rubygems

Version Path
graphql-1.10.14 lib/graphql/dig.rb
graphql-1.11.1 lib/graphql/dig.rb
graphql-1.10.13 lib/graphql/dig.rb
graphql-1.11.0 lib/graphql/dig.rb
graphql-1.10.12 lib/graphql/dig.rb
graphql-1.9.21 lib/graphql/dig.rb
graphql-1.10.11 lib/graphql/dig.rb
graphql-1.9.20 lib/graphql/dig.rb
graphql-1.10.10 lib/graphql/dig.rb
graphql-1.10.9 lib/graphql/dig.rb
graphql-1.10.8 lib/graphql/dig.rb
graphql-1.10.7 lib/graphql/dig.rb
graphql-1.10.6 lib/graphql/dig.rb
graphql-1.10.5 lib/graphql/dig.rb
graphql-1.10.4 lib/graphql/dig.rb
graphql-1.10.3 lib/graphql/dig.rb
graphql-1.10.2 lib/graphql/dig.rb
graphql-1.9.19 lib/graphql/dig.rb
graphql-1.10.1 lib/graphql/dig.rb
graphql-1.10.0 lib/graphql/dig.rb