Class: Textus::Action::SchemaEnvelope

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

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.



15
16
17
18
# File 'lib/textus/action/schema_envelope.rb', line 15

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

Instance Method Details

#call(container:) ⇒ Object



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

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