Class: ElasticGraph::GraphQL::Aggregation::PathSegment
- Inherits:
-
Data
- Object
- Data
- ElasticGraph::GraphQL::Aggregation::PathSegment
- Defined in:
- lib/elastic_graph/graphql/aggregation/path_segment.rb
Instance Attribute Summary collapse
-
#name_in_graphql_query ⇒ Object
readonly
Returns the value of attribute name_in_graphql_query.
-
#name_in_index ⇒ Object
readonly
Returns the value of attribute name_in_index.
Class Method Summary collapse
-
.for(lookahead:, field: nil) ⇒ Object
Factory method that aids in building a ‘PathSegment` for a given `field` and `lookahead` node.
Instance Attribute Details
#name_in_graphql_query ⇒ Object (readonly)
Returns the value of attribute name_in_graphql_query
12 13 14 |
# File 'lib/elastic_graph/graphql/aggregation/path_segment.rb', line 12 def name_in_graphql_query @name_in_graphql_query end |
#name_in_index ⇒ Object (readonly)
Returns the value of attribute name_in_index
12 13 14 |
# File 'lib/elastic_graph/graphql/aggregation/path_segment.rb', line 12 def name_in_index @name_in_index end |
Class Method Details
.for(lookahead:, field: nil) ⇒ Object
Factory method that aids in building a ‘PathSegment` for a given `field` and `lookahead` node.
20 21 22 23 24 25 26 27 |
# File 'lib/elastic_graph/graphql/aggregation/path_segment.rb', line 20 def self.for(lookahead:, field: nil) ast_node = lookahead.ast_nodes.first # : ::GraphQL::Language::Nodes::Field new( name_in_graphql_query: ast_node.alias || ast_node.name, name_in_index: field&.name_in_index ) end |