Class: ElasticGraph::SchemaDefinition::SchemaElements::FieldPath

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_graph/schema_definition/schema_elements/field_path.rb

Overview

Represents a potentially nested path to a field.

Defined Under Namespace

Classes: Resolver

Instance Method Summary collapse

Instance Method Details

#full_descriptionObject

The full description of the field path, including the parent type name, and field type, such as “Widget.nested.some_field: ID”.



42
43
44
# File 'lib/elastic_graph/schema_definition/schema_elements/field_path.rb', line 42

def full_description
  "#{fully_qualified_path}: #{type.name}"
end

#fully_qualified_pathObject

The full name of the field path, including the parent type name, such as “Widget.nested.some_field”.



31
32
33
# File 'lib/elastic_graph/schema_definition/schema_elements/field_path.rb', line 31

def fully_qualified_path
  "#{first_part.parent_type.name}.#{path}"
end

#fully_qualified_path_in_indexObject

The full name of the field path in the index, including the parent type name, such as “Widget.nested.some_field”.



36
37
38
# File 'lib/elastic_graph/schema_definition/schema_elements/field_path.rb', line 36

def fully_qualified_path_in_index
  "#{first_part.parent_type.name}.#{path_in_index}"
end

#pathObject



21
22
23
# File 'lib/elastic_graph/schema_definition/schema_elements/field_path.rb', line 21

def path
  path_parts.map(&:name).join(".")
end

#path_in_indexObject

The full path to the field in the index.



26
27
28
# File 'lib/elastic_graph/schema_definition/schema_elements/field_path.rb', line 26

def path_in_index
  path_parts.map(&:name_in_index).join(".")
end

#typeObject

The type of the field (based purely on the last part; the parent parts aren’t interesting here).



17
18
19
# File 'lib/elastic_graph/schema_definition/schema_elements/field_path.rb', line 17

def type
  last_part.type
end