Class: Textus::Application::Read::SchemaEnvelope::Impl

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/application/read/schema_envelope.rb

Instance Method Summary collapse

Constructor Details

#initialize(caps:) ⇒ Impl

Returns a new instance of Impl.



10
11
12
13
# File 'lib/textus/application/read/schema_envelope.rb', line 10

def initialize(caps:)
  @manifest = caps.manifest
  @schemas  = caps.schemas
end

Instance Method Details

#call(key) ⇒ Object



15
16
17
18
19
# File 'lib/textus/application/read/schema_envelope.rb', line 15

def call(key)
  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