Sha256: ce029df8d411ef805b58e7a98fb3f677e71126a57fdf2d13261844d87d543ee0
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require 'active_support/core_ext/string/filters' require 'graphql_rails/attribute' module GraphqlRails class Controller # stores all graphql_rails contoller specific config class ActionConfiguration attr_reader :attributes, :return_type def initialize @attributes = {} @can_return_nil = false end def permit(*no_type_attributes, **typed_attributes) no_type_attributes.each { |attribute| permit_attribute(attribute) } typed_attributes.each { |attribute, type| permit_attribute(attribute, type) } self end def description(new_description = nil) if new_description @description = new_description self else @description end end def can_return_nil @can_return_nil = true self end def returns(new_return_type) @return_type = new_return_type self end def can_return_nil? @can_return_nil end private def permit_attribute(name, type = nil) field_name = name.to_s.remove(/!\Z/) attributes[field_name] = Attribute.new(field_name, type) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
graphql_rails-0.2.3 | lib/graphql_rails/controller/action_configuration.rb |