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.13.23 lib/graphql/dig.rb
graphql-1.13.22 lib/graphql/dig.rb
graphql-1.13.21 lib/graphql/dig.rb
graphql-1.13.20 lib/graphql/dig.rb
graphql-1.13.19 lib/graphql/dig.rb
graphql-1.13.18 lib/graphql/dig.rb
graphql-1.13.17 lib/graphql/dig.rb
graphql-1.13.16 lib/graphql/dig.rb
graphql-1.13.15 lib/graphql/dig.rb
graphql-1.13.14 lib/graphql/dig.rb
graphql-1.13.13 lib/graphql/dig.rb
graphql_cody-1.13.0 lib/graphql/dig.rb
graphql-1.13.12 lib/graphql/dig.rb
graphql-1.13.11 lib/graphql/dig.rb
graphql-1.13.10 lib/graphql/dig.rb
graphql-1.13.9 lib/graphql/dig.rb
graphql-1.12.24 lib/graphql/dig.rb
graphql-1.13.8 lib/graphql/dig.rb
graphql-1.13.7 lib/graphql/dig.rb
graphql-1.13.6 lib/graphql/dig.rb