Class: ReactOnRailsPro::ImmediateAsyncValue

Inherits:
Object
  • Object
show all
Defined in:
lib/react_on_rails_pro/immediate_async_value.rb

Overview

ImmediateAsyncValue is returned when a cached_async_react_component call has a cache hit. It provides the same interface as AsyncValue but returns the cached value immediately without any async operations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ImmediateAsyncValue

Returns a new instance of ImmediateAsyncValue.



22
23
24
# File 'lib/react_on_rails_pro/immediate_async_value.rb', line 22

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



26
27
28
# File 'lib/react_on_rails_pro/immediate_async_value.rb', line 26

def value
  @value
end

Instance Method Details

#html_safeObject



36
37
38
# File 'lib/react_on_rails_pro/immediate_async_value.rb', line 36

def html_safe
  @value.html_safe
end

#resolved?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/react_on_rails_pro/immediate_async_value.rb', line 28

def resolved?
  true
end

#to_sObject



32
33
34
# File 'lib/react_on_rails_pro/immediate_async_value.rb', line 32

def to_s
  @value.to_s
end