Class: GraphqlRails::Model::AddFieldsToGraphqlType
- Inherits:
-
Object
- Object
- GraphqlRails::Model::AddFieldsToGraphqlType
- Includes:
- Service
- Defined in:
- lib/graphql_rails/model/add_fields_to_graphql_type.rb
Overview
Adds graphql attributes as graphql fields to given graphql schema object.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(klass:, attributes:) ⇒ AddFieldsToGraphqlType
constructor
A new instance of AddFieldsToGraphqlType.
Constructor Details
#initialize(klass:, attributes:) ⇒ AddFieldsToGraphqlType
Returns a new instance of AddFieldsToGraphqlType.
13 14 15 16 |
# File 'lib/graphql_rails/model/add_fields_to_graphql_type.rb', line 13 def initialize(klass:, attributes:) @klass = klass @attributes = attributes end |
Instance Method Details
#call ⇒ Object
18 19 20 |
# File 'lib/graphql_rails/model/add_fields_to_graphql_type.rb', line 18 def call attributes.each { |attribute| define_graphql_field(attribute) } end |