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.



9
10
11
# File 'lib/react_on_rails_pro/immediate_async_value.rb', line 9

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13
14
15
# File 'lib/react_on_rails_pro/immediate_async_value.rb', line 13

def value
  @value
end

Instance Method Details

#html_safeObject



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

def html_safe
  @value.html_safe
end

#resolved?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/react_on_rails_pro/immediate_async_value.rb', line 15

def resolved?
  true
end

#to_sObject



19
20
21
# File 'lib/react_on_rails_pro/immediate_async_value.rb', line 19

def to_s
  @value.to_s
end