Class: Textus::Read::SchemaEnvelope

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

Instance Method Summary collapse

Constructor Details

#initialize(container:, call: nil) ⇒ SchemaEnvelope

rubocop:disable Lint/UnusedMethodArgument



4
5
6
7
# File 'lib/textus/read/schema_envelope.rb', line 4

def initialize(container:, call: nil) # rubocop:disable Lint/UnusedMethodArgument
  @manifest = container.manifest
  @schemas  = container.schemas
end

Instance Method Details

#call(key) ⇒ Object



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

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