Class: ElasticGraph::SchemaArtifacts::RuntimeMetadata::GraphQLExtension

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_extension.rb

Constant Summary collapse

EXTENSION_REF =
"extension_ref"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



26
27
28
29
30
# File 'lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_extension.rb', line 26

def self.from_hash(hash)
  new(
    extension_ref: hash.fetch(EXTENSION_REF)
  )
end

.loaderObject



16
17
18
# File 'lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_extension.rb', line 16

def self.loader
  @loader ||= ExtensionLoader.new(Module.new)
end

Instance Method Details

#load_extensionObject



22
23
24
# File 'lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_extension.rb', line 22

def load_extension
  Extension.load_from_hash(extension_ref, via: GraphQLExtension.loader)
end

#to_dumpable_hashObject



32
33
34
35
36
37
# File 'lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_extension.rb', line 32

def to_dumpable_hash
  {
    # Keys here are ordered alphabetically; please keep them that way.
    EXTENSION_REF => extension_ref
  }
end