Class: GraphQL::Syntax::Call

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/syntax/call.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier:, argument: nil, calls: []) ⇒ Call



3
4
5
6
7
# File 'lib/graphql/syntax/call.rb', line 3

def initialize(identifier:, argument: nil, calls: [])
  @identifier = identifier
  @argument = argument
  @calls = calls
end

Instance Attribute Details

#argumentObject (readonly)

Returns the value of attribute argument.



2
3
4
# File 'lib/graphql/syntax/call.rb', line 2

def argument
  @argument
end

#callsObject (readonly)

Returns the value of attribute calls.



2
3
4
# File 'lib/graphql/syntax/call.rb', line 2

def calls
  @calls
end

#identifierObject (readonly)

Returns the value of attribute identifier.



2
3
4
# File 'lib/graphql/syntax/call.rb', line 2

def identifier
  @identifier
end

Instance Method Details

#execute!(query) ⇒ Object



9
10
11
12
# File 'lib/graphql/syntax/call.rb', line 9

def execute!(query)
  node_class = query.get_node(identifier)
  node_class.call(argument)
end

#to_queryObject



14
15
16
# File 'lib/graphql/syntax/call.rb', line 14

def to_query
  (["#{identifier}(#{argument})"] + calls.map(&:to_query)).join(".")
end