Module: SearchObject::Plugin::Graphql::ClassMethods
- Defined in:
- lib/search_object/plugin/graphql.rb
Instance Method Summary collapse
- #arguments ⇒ Object
-
#call(object, args, context) ⇒ Object
NOTE(rstankov): GraphQL::Function interface Documentation - rmosolgo.github.io/graphql-ruby/schema/code_reuse#functions.
- #complexity(value = :default) ⇒ Object
- #deprecation_reason(value = :default) ⇒ Object
- #description(value = :default) ⇒ Object
- #option(name, options = {}, &block) ⇒ Object
- #type(value = :default, &block) ⇒ Object
- #types ⇒ Object
Instance Method Details
#arguments ⇒ Object
38 39 40 |
# File 'lib/search_object/plugin/graphql.rb', line 38 def arguments config[:args] ||= {} end |
#call(object, args, context) ⇒ Object
NOTE(rstankov): GraphQL::Function interface Documentation - rmosolgo.github.io/graphql-ruby/schema/code_reuse#functions
34 35 36 |
# File 'lib/search_object/plugin/graphql.rb', line 34 def call(object, args, context) new(filters: args.to_h, object: object, context: context).results end |
#complexity(value = :default) ⇒ Object
47 48 49 50 |
# File 'lib/search_object/plugin/graphql.rb', line 47 def complexity(value = :default) return config[:complexity] || 1 if value == :default config[:complexity] = value end |
#deprecation_reason(value = :default) ⇒ Object
57 58 59 60 |
# File 'lib/search_object/plugin/graphql.rb', line 57 def deprecation_reason(value = :default) return config[:deprecation_reason] if value == :default config[:deprecation_reason] = value end |
#description(value = :default) ⇒ Object
52 53 54 55 |
# File 'lib/search_object/plugin/graphql.rb', line 52 def description(value = :default) return config[:description] if value == :default config[:description] = value end |
#option(name, options = {}, &block) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/search_object/plugin/graphql.rb', line 19 def option(name, = {}, &block) argument = Helper.build_argument(name, ) arguments[argument.name] = argument [:enum] = argument.type.values.keys if argument.type.is_a? GraphQL::EnumType super(name, , &block) end |
#type(value = :default, &block) ⇒ Object
42 43 44 45 |
# File 'lib/search_object/plugin/graphql.rb', line 42 def type(value = :default, &block) return config[:type] if value == :default && !block_given? config[:type] = block_given? ? GraphQL::ObjectType.define(&block) : value end |
#types ⇒ Object
28 29 30 |
# File 'lib/search_object/plugin/graphql.rb', line 28 def types GraphQL::Define::TypeDefiner.instance end |