Class: GraphqlRails::Model::BuildConnectionType::CountItems
- Inherits:
-
Object
- Object
- GraphqlRails::Model::BuildConnectionType::CountItems
- Includes:
- Service
- Defined in:
- lib/graphql_rails/model/build_connection_type/count_items.rb
Overview
Used when generating ConnectionType. It handles all the logic which is related with counting total items
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(graphql_object) ⇒ CountItems
constructor
A new instance of CountItems.
Constructor Details
#initialize(graphql_object) ⇒ CountItems
Returns a new instance of CountItems.
13 14 15 |
# File 'lib/graphql_rails/model/build_connection_type/count_items.rb', line 13 def initialize(graphql_object) @graphql_object = graphql_object end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/graphql_rails/model/build_connection_type/count_items.rb', line 17 def call if active_record? list.except(:offset).size else list.size end end |