Sha256: 485d221860ae93cc210fa55220ca8d1874934f979860ff6c5f44419d6a9b6c96

Contents?: true

Size: 655 Bytes

Versions: 1

Compression:

Stored size: 655 Bytes

Contents

module GraphQL
  module Define
    # Turn argument configs into a {GraphQL::Argument}.
    module AssignArgument
      def self.call(target, name, type, description = nil, default_value: nil, &block)
        argument = if block_given?
          GraphQL::Argument.define(&block)
        else
          GraphQL::Argument.new
        end
        argument.name = name.to_s
        argument.type = type

        description && argument.description = description
        # check nil because false is a valid value
        default_value != nil && argument.default_value = default_value

        target.arguments[name.to_s] = argument
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graphql-0.13.0 lib/graphql/define/assign_argument.rb