Module: GraphQL::DefinitionHelpers::DefinedByConfig::ClassMethods

Defined in:
lib/graphql/definition_helpers/defined_by_config.rb

Instance Method Summary collapse

Instance Method Details

#define(&block) ⇒ Object

Pass the block to this class's `DefinitionConfig`, The return the result of DefinitionConfig#to_instance


106
107
108
109
110
# File 'lib/graphql/definition_helpers/defined_by_config.rb', line 106

def define(&block)
  config = DefinitionConfig.new
  block && config.instance_eval(&block)
  config.to_instance(self.new, @defined_attrs)
end

#defined_by_config(*defined_attrs) ⇒ Object


112
113
114
115
# File 'lib/graphql/definition_helpers/defined_by_config.rb', line 112

def defined_by_config(*defined_attrs)
  @defined_attrs ||= []
  @defined_attrs += defined_attrs
end