Class: GQL::Executor
- Inherits:
-
Object
- Object
- GQL::Executor
- Defined in:
- lib/gql/executor.rb
Instance Method Summary collapse
- #execute(context = {}) ⇒ Object
-
#initialize(ast_root) ⇒ Executor
constructor
A new instance of Executor.
Constructor Details
#initialize(ast_root) ⇒ Executor
Returns a new instance of Executor.
3 4 5 6 |
# File 'lib/gql/executor.rb', line 3 def initialize(ast_root) @ast_root = ast_root @variables = ast_root.variables end |
Instance Method Details
#execute(context = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/gql/executor.rb', line 8 def execute(context = {}) root_class = Schema.root raise Errors::UndefinedRoot if root_class.nil? raise Errors::InvalidNodeClass.new(root_class, Node) unless root_class < Node root = root_class.new(@ast_root, nil, @variables, context) root.__value end |