Class: Textus::Handlers::Maintenance::SchemaEnvelope

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

Instance Method Summary collapse

Constructor Details

#initialize(manifest:, schemas:) ⇒ SchemaEnvelope

Returns a new instance of SchemaEnvelope.



5
6
7
8
# File 'lib/textus/handlers/maintenance/schema_envelope.rb', line 5

def initialize(manifest:, schemas:)
  @manifest = manifest
  @schemas = schemas
end

Instance Method Details

#call(command, _call) ⇒ Object



10
11
12
13
14
15
# File 'lib/textus/handlers/maintenance/schema_envelope.rb', line 10

def call(command, _call)
  mentry = @manifest.resolver.resolve(command.key).entry
  schema = @schemas.fetch_or_nil(mentry.schema)
  Value::Result.success("protocol" => Textus::PROTOCOL, "key" => command.key,
                        "schema_ref" => mentry.schema, "schema" => schema&.to_h)
end