Class: Giraph::Subquery
- Inherits:
-
Object
- Object
- Giraph::Subquery
- Defined in:
- lib/giraph/subquery.rb
Overview
Defines a thin & sane API for the sub-query extraction from the context provided to resolvers via AST, graphql-ruby API and a touch of regex.
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#query_string ⇒ Object
readonly
Returns the value of attribute query_string.
Instance Method Summary collapse
-
#initialize(context) ⇒ Subquery
constructor
A new instance of Subquery.
- #subquery_string ⇒ Object
- #variable_string ⇒ Object
Constructor Details
#initialize(context) ⇒ Subquery
Returns a new instance of Subquery.
8 9 10 11 12 13 |
# File 'lib/giraph/subquery.rb', line 8 def initialize(context) @context = context @query = context.query @query_string = context.ast_node.to_query_string end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
6 7 8 |
# File 'lib/giraph/subquery.rb', line 6 def query @query end |
#query_string ⇒ Object (readonly)
Returns the value of attribute query_string.
6 7 8 |
# File 'lib/giraph/subquery.rb', line 6 def query_string @query_string end |
Instance Method Details
#subquery_string ⇒ Object
15 16 17 |
# File 'lib/giraph/subquery.rb', line 15 def subquery_string "GiraphQuery #{query_variables} #{query_selections}" end |
#variable_string ⇒ Object
19 20 21 22 23 24 |
# File 'lib/giraph/subquery.rb', line 19 def variable_string dict = variable_assignments dict = yield dict if block_given? dict.to_json end |