Class: OmnifocusMcp::Tools::Operations::BatchAddItems::BatchItem
- Inherits:
-
Object
- Object
- OmnifocusMcp::Tools::Operations::BatchAddItems::BatchItem
- Defined in:
- lib/omnifocus_mcp/tools/operations/batch_add_items/batch_item.rb
Overview
In-flight bookkeeping for one item in a batch. The original payload and its position in the input array are read-only; status and result are mutated as the batch processes.
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#result ⇒ Object
Returns the value of attribute result.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #fail!(message) ⇒ Object
-
#initialize(payload:, index:) ⇒ BatchItem
constructor
A new instance of BatchItem.
- #pending? ⇒ Boolean
- #succeed!(value) ⇒ Object
Constructor Details
#initialize(payload:, index:) ⇒ BatchItem
Returns a new instance of BatchItem.
16 17 18 19 20 21 |
# File 'lib/omnifocus_mcp/tools/operations/batch_add_items/batch_item.rb', line 16 def initialize(payload:, index:) @payload = payload @index = index @status = :pending @result = nil end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
13 14 15 |
# File 'lib/omnifocus_mcp/tools/operations/batch_add_items/batch_item.rb', line 13 def index @index end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
13 14 15 |
# File 'lib/omnifocus_mcp/tools/operations/batch_add_items/batch_item.rb', line 13 def payload @payload end |
#result ⇒ Object
Returns the value of attribute result.
14 15 16 |
# File 'lib/omnifocus_mcp/tools/operations/batch_add_items/batch_item.rb', line 14 def result @result end |
#status ⇒ Object
Returns the value of attribute status.
14 15 16 |
# File 'lib/omnifocus_mcp/tools/operations/batch_add_items/batch_item.rb', line 14 def status @status end |
Instance Method Details
#fail!(message) ⇒ Object
25 26 27 28 |
# File 'lib/omnifocus_mcp/tools/operations/batch_add_items/batch_item.rb', line 25 def fail!() @status = :failed @result = OmnifocusMcp::Result.error() end |
#pending? ⇒ Boolean
23 |
# File 'lib/omnifocus_mcp/tools/operations/batch_add_items/batch_item.rb', line 23 def pending? = @status == :pending |
#succeed!(value) ⇒ Object
30 31 32 33 |
# File 'lib/omnifocus_mcp/tools/operations/batch_add_items/batch_item.rb', line 30 def succeed!(value) @status = :succeeded @result = OmnifocusMcp::Result.ok(value) end |