Class: Textus::Action::SchemaEnvelope

Inherits:
Base
  • Object
show all
Extended by:
Contract::DSL
Defined in:
lib/textus/action/schema_envelope.rb

Constant Summary collapse

BURN =
:sync

Instance Method Summary collapse

Methods included from Contract::DSL

arg, around, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view

Methods inherited from Base

#args, inherited

Constructor Details

#initialize(key:) ⇒ SchemaEnvelope

Returns a new instance of SchemaEnvelope.



17
18
19
20
# File 'lib/textus/action/schema_envelope.rb', line 17

def initialize(key:)
  super()
  @key = key
end

Instance Method Details

#call(container:) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/textus/action/schema_envelope.rb', line 22

def call(container:, **)
  manifest = container.manifest
  schemas = container.schemas
  mentry = manifest.resolver.resolve(@key).entry
  schema = schemas.fetch_or_nil(mentry.schema)
  { "protocol" => PROTOCOL, "key" => @key, "schema_ref" => mentry.schema, "schema" => schema&.to_h }
end