Method: GraphQL::Execution::Lookahead#selects_alias?

Defined in:
lib/graphql/execution/lookahead.rb

#selects_alias?(alias_name, arguments: nil) ⇒ Boolean

True if this node has a selection with alias matching alias_name. If alias_name is a String, it is treated as a GraphQL-style (camelized) field name and used verbatim. If alias_name is a Symbol, it is treated as a Ruby-style (underscored) name and camelized before comparing.

If arguments: is provided, each provided key/value will be matched against the arguments in the next selection. This method will return false if any of the given arguments: are not present and matching in the next selection. (But, the next selection may contain more than the given arguments.)

Parameters:

  • alias_name (String, Symbol)
  • arguments (Hash) (defaults to: nil)

    Arguments which must match in the selection

Returns:

  • (Boolean)


102
103
104
# File 'lib/graphql/execution/lookahead.rb', line 102

def selects_alias?(alias_name, arguments: nil)
  alias_selection(alias_name, arguments: arguments).selected?
end