Sha256: 751573a54cc0b5985d8616a691f024a7bd4946f294c7f79bedac754a0cdf518c

Contents?: true

Size: 741 Bytes

Versions: 6

Compression:

Stored size: 741 Bytes

Contents

module GraphQL
  module Define
    # Turn field configs into a {GraphQL::Field} and attach it to a {GraphQL::ObjectType} or {GraphQL::InterfaceType}
    module AssignObjectField
      def self.call(fields_type, name, type = nil, desc = nil, field: nil, deprecation_reason: nil, property: nil, &block)
        if block_given?
          field = GraphQL::Field.define(&block)
        else
          field ||= GraphQL::Field.new
        end
        type && field.type = type
        desc && field.description = desc
        property && field.property = property
        deprecation_reason && field.deprecation_reason = deprecation_reason
        field.name ||= name.to_s
        fields_type.fields[name.to_s] = field
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
graphql-0.15.3 lib/graphql/define/assign_object_field.rb
graphql-0.15.2 lib/graphql/define/assign_object_field.rb
graphql-0.14.2 lib/graphql/define/assign_object_field.rb
graphql-0.15.1 lib/graphql/define/assign_object_field.rb
graphql-0.15.0 lib/graphql/define/assign_object_field.rb
graphql-0.14.1 lib/graphql/define/assign_object_field.rb