Class: GraphQL::Syntax::Call
- Inherits:
-
Object
- Object
- GraphQL::Syntax::Call
- Defined in:
- lib/graphql/syntax/call.rb
Instance Attribute Summary collapse
-
#argument ⇒ Object
readonly
Returns the value of attribute argument.
-
#calls ⇒ Object
readonly
Returns the value of attribute calls.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Instance Method Summary collapse
- #execute!(query) ⇒ Object
-
#initialize(identifier:, argument: nil, calls: []) ⇒ Call
constructor
A new instance of Call.
- #to_query ⇒ Object
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
#argument ⇒ Object (readonly)
Returns the value of attribute argument.
2 3 4 |
# File 'lib/graphql/syntax/call.rb', line 2 def argument @argument end |
#calls ⇒ Object (readonly)
Returns the value of attribute calls.
2 3 4 |
# File 'lib/graphql/syntax/call.rb', line 2 def calls @calls end |
#identifier ⇒ Object (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_query ⇒ Object
14 15 16 |
# File 'lib/graphql/syntax/call.rb', line 14 def to_query (["#{identifier}(#{argument})"] + calls.map(&:to_query)).join(".") end |