module GraphqlRails::InputConfigurable
contains configuration options related with inputs
Public Instance Methods
build_input_attribute(name, options: {}, **other_options)
click to toggle source
# File lib/graphql_rails/input_configurable.rb, line 39 def build_input_attribute(name, options: {}, **other_options) Attributes::InputAttribute.new( name.to_s, options: input_attribute_options.merge(options), **other_options ) end
input_attribute_options()
click to toggle source
# File lib/graphql_rails/input_configurable.rb, line 35 def input_attribute_options @input_attribute_options || {} end
paginated(pagination_options = {})
click to toggle source
# File lib/graphql_rails/input_configurable.rb, line 19 def paginated(pagination_options = {}) pagination_options = {} if pagination_options == true pagination_options = nil if pagination_options == false @pagination_options = pagination_options permit(:before, :after, first: :int, last: :int) end
paginated?()
click to toggle source
# File lib/graphql_rails/input_configurable.rb, line 27 def paginated? !pagination_options.nil? end
pagination_options()
click to toggle source
# File lib/graphql_rails/input_configurable.rb, line 31 def pagination_options @pagination_options end
permit(*no_type_attributes, **typed_attributes)
click to toggle source
# File lib/graphql_rails/input_configurable.rb, line 6 def permit(*no_type_attributes, **typed_attributes) no_type_attributes.each { |attribute| permit_input(attribute) } typed_attributes.each { |attribute, type| permit_input(attribute, type: type) } self end
permit_input(name, **input_options)
click to toggle source
# File lib/graphql_rails/input_configurable.rb, line 12 def permit_input(name, **input_options) field_name = name.to_s.remove(/!\Z/) attributes[field_name] = build_input_attribute(name.to_s, **input_options) self end