Class: Textus::Read::SchemaEnvelope

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

Instance Method Summary collapse

Methods included from Contract::DSL

arg, contract, contract?, response, summary, surfaces, verb

Constructor Details

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

rubocop:disable Lint/UnusedMethodArgument



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

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

Instance Method Details

#call(key) ⇒ Object



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

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