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.
12 13 14 15 |
# File 'lib/graphql_rails/model/add_fields_to_graphql_type.rb', line 12 def initialize(klass:, attributes:) @klass = klass @attributes = attributes end |
Instance Method Details
#call ⇒ Object
17 18 19 |
# File 'lib/graphql_rails/model/add_fields_to_graphql_type.rb', line 17 def call attributes.each { |attribute| define_graphql_field(attribute) } end |