Class: ElasticGraph::SchemaArtifacts::RuntimeMetadata::Relation
- Inherits:
-
Object
- Object
- ElasticGraph::SchemaArtifacts::RuntimeMetadata::Relation
- Defined in:
- lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb
Constant Summary collapse
- FOREIGN_KEY =
"foreign_key"- DIRECTION =
"direction"- ADDITIONAL_FILTER =
"additional_filter"- FOREIGN_KEY_NESTED_PATHS =
"foreign_key_nested_paths"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_hash(hash) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb', line 18 def self.from_hash(hash) new( foreign_key: hash[FOREIGN_KEY], direction: hash.fetch(DIRECTION).to_sym, additional_filter: hash[ADDITIONAL_FILTER] || {}, foreign_key_nested_paths: hash[FOREIGN_KEY_NESTED_PATHS] || [] ) end |
Instance Method Details
#to_dumpable_hash ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb', line 27 def to_dumpable_hash { # Keys here are ordered alphabetically; please keep them that way. ADDITIONAL_FILTER => additional_filter, DIRECTION => direction.to_s, FOREIGN_KEY => foreign_key, FOREIGN_KEY_NESTED_PATHS => foreign_key_nested_paths } end |