Class: Solana::Ruby::Kit::Subscribable::ReactiveState
- Inherits:
-
Object
- Object
- Solana::Ruby::Kit::Subscribable::ReactiveState
- Extended by:
- T::Sig
- Defined in:
- lib/solana/ruby/kit/subscribable/reactive_stream_store.rb
Overview
Lifecycle snapshot of a ReactiveStreamStore — a single frozen value capturing status, last-known data, and any error.
status values:
'loading' — waiting for first value; data is nil
'loaded' — value has arrived, no active error
'error' — stream failed; data is last known value (may be nil)
'retrying' — retry in progress after error; data preserved
Mirrors TypeScript’s ReactiveState<T>.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(status:, data: nil, error: nil) ⇒ ReactiveState
constructor
A new instance of ReactiveState.
Constructor Details
#initialize(status:, data: nil, error: nil) ⇒ ReactiveState
Returns a new instance of ReactiveState.
34 35 36 37 38 39 |
# File 'lib/solana/ruby/kit/subscribable/reactive_stream_store.rb', line 34 def initialize(status:, data: nil, error: nil) @status = T.let(status, String) @data = T.let(data, T.untyped) @error = T.let(error, T.untyped) freeze end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
28 29 30 |
# File 'lib/solana/ruby/kit/subscribable/reactive_stream_store.rb', line 28 def data @data end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
31 32 33 |
# File 'lib/solana/ruby/kit/subscribable/reactive_stream_store.rb', line 31 def error @error end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
25 26 27 |
# File 'lib/solana/ruby/kit/subscribable/reactive_stream_store.rb', line 25 def status @status end |
Instance Method Details
#==(other) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/solana/ruby/kit/subscribable/reactive_stream_store.rb', line 42 def ==(other) other.is_a?(ReactiveState) && @status == other.status && @data.equal?(other.data) && @error.equal?(other.error) end |