Module: GraphqlRails::Model::ClassMethods

Defined in:
lib/graphql_rails/model.rb

Overview

static methods for GraphqlRails::Model

Instance Method Summary collapse

Instance Method Details

#graphqlObject



29
30
31
32
33
# File 'lib/graphql_rails/model.rb', line 29

def graphql
  @graphql ||= Model::Configuration.new(self)
  @graphql.tap { |it| yield(it) }.with_ensured_fields! if block_given?
  @graphql
end

#inherited(subclass) ⇒ Object



22
23
24
25
26
27
# File 'lib/graphql_rails/model.rb', line 22

def inherited(subclass)
  super
  subclass.instance_variable_set(:@graphql, graphql.dup)
  subclass.graphql.instance_variable_set(:@model_class, self)
  subclass.graphql.instance_variable_set(:@graphql_type, nil)
end