Sha256: 8a367b861ab6a6bc7177754fb0a2f501573966f74eb3c7c03508138208873942

Contents?: true

Size: 901 Bytes

Versions: 8

Compression:

Stored size: 901 Bytes

Contents

require 'active_support/concern'
require_relative '../../../input_types/base_list_comparison_input_type'
require_relative '../../../input_types/list_scalar_comparison_input_type'
require_relative '../../../input_types/list_object_comparison_input_type'

monkey_patch = Module.new do
  extend ActiveSupport::Concern

  def comparison_input_type new_comparison_input_type=nil
    if new_comparison_input_type.present?
      @comparison_input_type = new_comparison_input_type
    else
      @comparison_input_type ||= build_comparison_input_type
    end
  end

protected

  def build_comparison_input_type
    if [GraphQL::TypeKinds::SCALAR, GraphQL::TypeKinds::ENUM].include? unwrap.kind
      GraphQL::Filters::InputTypes::ListScalarComparisonInputType[self]
    else
      GraphQL::Filters::InputTypes::ListObjectComparisonInputType[self]
    end
  end
end

GraphQL::Schema::List.prepend monkey_patch

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
graphql-filters-1.0.7 lib/graphql/filters/dsl/graphql/schema/list.rb
graphql-filters-1.0.6 lib/graphql/filters/dsl/graphql/schema/list.rb
graphql-filters-1.0.5 lib/graphql/filters/dsl/graphql/schema/list.rb
graphql-filters-1.0.4 lib/graphql/filters/dsl/graphql/schema/list.rb
graphql-filters-1.0.3 lib/graphql/filters/dsl/graphql/schema/list.rb
graphql-filters-1.0.2 lib/graphql/filters/dsl/graphql/schema/list.rb
graphql-filters-1.0.1 lib/graphql/filters/dsl/graphql/schema/list.rb
graphql-filters-1.0.0 lib/graphql/filters/dsl/graphql/schema/list.rb