Class: Textus::Handlers::Read::GetEntry
- Inherits:
-
Object
- Object
- Textus::Handlers::Read::GetEntry
- Defined in:
- lib/textus/handlers/read/get_entry.rb
Constant Summary collapse
- MAX_SOURCE_DEPTH =
5
Instance Method Summary collapse
- #call(command, _call) ⇒ Object
-
#initialize(container:, freshness_evaluator:) ⇒ GetEntry
constructor
A new instance of GetEntry.
Constructor Details
#initialize(container:, freshness_evaluator:) ⇒ GetEntry
Returns a new instance of GetEntry.
5 6 7 8 |
# File 'lib/textus/handlers/read/get_entry.rb', line 5 def initialize(container:, freshness_evaluator:) @container = container @freshness_evaluator = freshness_evaluator end |
Instance Method Details
#call(command, _call) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/textus/handlers/read/get_entry.rb', line 10 def call(command, _call) envelope = Store::Entry::Reader.from(container: @container).read(command.key) return Value::Result.failure(:not_found, "no entry at #{command.key}") unless envelope envelope = (envelope, depth: 0) Value::Result.success(envelope.with(freshness: @freshness_evaluator.verdict(resolve_entry(command.key)))) end |