class GraphQL::Analysis::AST::QueryComplexity::ScopedTypeComplexity
def initialize(parent_type, field_definition, query, response_path)
-
response_path
(Array
) -- The path to the response key for the field -
query
(GraphQL::Query
) -- Used for `query.possible_types` -
field_definition
(GraphQL::Field, GraphQL::Schema::Field
) -- Used for getting the `.complexity` configuration -
parent_type
(Class
) -- The owner of `field_definition`
def initialize(parent_type, field_definition, query, response_path) @parent_type = parent_type @field_definition = field_definition @query = query @response_path = response_path @scoped_children = nil @nodes = [] end
def own_complexity(child_complexity)
def own_complexity(child_complexity) @field_definition.calculate_complexity(query: @query, nodes: @nodes, child_complexity: child_complexity) end
def scoped_children
-
(Hash
- HashScopedTypeComplexity>]) ScopedTypeComplexity>]
def scoped_children @scoped_children ||= Hash.new(&HASH_CHILDREN) end
def terminal?
Returns true if this field has no selections, ie, it's a scalar.
def terminal? @scoped_children.nil? end