class GraphQL::Analysis::QueryComplexity::ScopedTypeComplexity
ScopedTypeComplexity models a tree of GraphQL types mapped to inner selections, ie: Hash<GraphQL::BaseType, Hash<String, ScopedTypeComplexity>>
Constants
- DEFAULT_PROC
-
A proc for defaulting empty namespace requests as a new scope hash.
Attributes
Returns
-
Array<GraphQL::Language::Nodes::Field>
Public Class Methods
# File lib/graphql/analysis/query_complexity.rb, line 68 def initialize(parent_type, field_definition, query, response_path) super(&DEFAULT_PROC) @parent_type = parent_type @field_definition = field_definition @query = query @response_path = response_path @nodes = [] end
Parameters
-
parent_type(Class) — The owner offield_definition -
field_definition(GraphQL::Field, GraphQL::Schema::Field) — Used for getting the.complexityconfiguration -
query(GraphQL::Query) — Used forquery.possible_types -
response_path(Array<String>) — The path to the response key for the field
Returns
-
Hash<GraphQL::BaseType, Hash<String, ScopedTypeComplexity>>
Calls superclass method
Public Instance Methods
Source
# File lib/graphql/analysis/query_complexity.rb, line 86 def composite? !empty? end
# File lib/graphql/analysis/query_complexity.rb, line 82 def own_complexity(child_complexity) @field_definition.calculate_complexity(query: @query, nodes: @nodes, child_complexity: child_complexity) end