Class: A2A::Task::Status
- Inherits:
-
Object
- Object
- A2A::Task::Status
- Defined in:
- lib/a2a/task/status.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(state:, message: nil, timestamp: nil) ⇒ Status
constructor
A new instance of Status.
- #terminal? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(state:, message: nil, timestamp: nil) ⇒ Status
Returns a new instance of Status.
8 9 10 11 12 |
# File 'lib/a2a/task/status.rb', line 8 def initialize(state:, message: nil, timestamp: nil) @state = state = = end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/a2a/task/status.rb', line 6 def end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
6 7 8 |
# File 'lib/a2a/task/status.rb', line 6 def state @state end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/a2a/task/status.rb', line 6 def end |
Class Method Details
.from_h(hash) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/a2a/task/status.rb', line 14 def self.from_h(hash) new( state: hash.fetch("state"), message: hash["message"] && Message.from_h(hash["message"]), timestamp: hash["timestamp"] ) end |
Instance Method Details
#terminal? ⇒ Boolean
30 31 32 |
# File 'lib/a2a/task/status.rb', line 30 def terminal? Task::State.terminal?(state) end |
#to_h ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/a2a/task/status.rb', line 22 def to_h { "state" => state, "message" => &.to_h, "timestamp" => }.compact end |