module SearchObject::Plugin::Graphql::ClassMethods

Public Instance Methods

option(name, options = {}, &block) click to toggle source
Calls superclass method
# File lib/search_object/plugin/graphql.rb, line 30
def option(name, options = {}, &block)
  type = options.fetch(:type) { raise MissingTypeDefinitionError, name }

  argument_options = { required: options[:required] || false }
  argument_options[:camelize] = options[:camelize] if options.include?(:camelize)
  argument_options[:default_value] = options[:default] if options.include?(:default)
  argument_options[:description] = options[:description] if options.include?(:description)

  argument(name.to_s, type, **argument_options)

  options[:enum] = type.values.map { |value, enum_value| enum_value.value || value } if type.respond_to?(:values)

  super(name, options, &block)
end
types() click to toggle source
# File lib/search_object/plugin/graphql.rb, line 45
def types
  GraphQL::Define::TypeDefiner.instance
end