Class: Solana::Ruby::Kit::Subscribable::ReactiveActionState

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/solana/ruby/kit/subscribable/reactive_action_store.rb

Overview

Lifecycle snapshot of a ReactiveActionStore. ‘data` persists across running/error states so callers can render stale content while a retry is in flight; only reset() clears it.

Mirrors TypeScript’s ReactiveActionState<TResult>.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, data: nil, error: nil) ⇒ ReactiveActionState

Returns a new instance of ReactiveActionState.



30
31
32
33
34
35
# File 'lib/solana/ruby/kit/subscribable/reactive_action_store.rb', line 30

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

#dataObject (readonly)

Returns the value of attribute data.



24
25
26
# File 'lib/solana/ruby/kit/subscribable/reactive_action_store.rb', line 24

def data
  @data
end

#errorObject (readonly)

Returns the value of attribute error.



27
28
29
# File 'lib/solana/ruby/kit/subscribable/reactive_action_store.rb', line 27

def error
  @error
end

#statusObject (readonly)

Returns the value of attribute status.



21
22
23
# File 'lib/solana/ruby/kit/subscribable/reactive_action_store.rb', line 21

def status
  @status
end

Instance Method Details

#==(other) ⇒ Object



38
39
40
41
42
43
# File 'lib/solana/ruby/kit/subscribable/reactive_action_store.rb', line 38

def ==(other)
  other.is_a?(ReactiveActionState) &&
    @status == other.status &&
    @data.equal?(other.data) &&
    @error.equal?(other.error)
end