Class: LucidComponent::AppStoreProxy
- Inherits:
-
Object
- Object
- LucidComponent::AppStoreProxy
show all
- Defined in:
- lib/isomorfeus_react/lucid_component/app_store_proxy.rb
Instance Method Summary
collapse
Constructor Details
#initialize(component_instance) ⇒ AppStoreProxy
Returns a new instance of AppStoreProxy.
3
4
5
6
7
8
|
# File 'lib/isomorfeus_react/lucid_component/app_store_proxy.rb', line 3
def initialize(component_instance)
if component_instance
@native = component_instance.to_n
@component_instance = component_instance
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, *args, &block) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/isomorfeus_react/lucid_component/app_store_proxy.rb', line 18
def method_missing(key, *args, &block)
if `args.length > 0`
action = { type: 'APPLICATION_STATE', name: (`key.endsWith('=')` ? key.chop : key), value: args[0] }
Isomorfeus.store.collect_and_defer_dispatch(action)
else
if @native && `#@native.props.store`
if `#@native.props.store.application_state && #@native.props.store.application_state.hasOwnProperty(key)`
return @native.JS[:props].JS[:store].JS[:application_state].JS[key]
end
else
return AppStore[key]
end
return nil
end
end
|
Instance Method Details
10
11
12
|
# File 'lib/isomorfeus_react/lucid_component/app_store_proxy.rb', line 10
def [](key)
method_missing(key)
end
|
#[]=(key, value) ⇒ Object
14
15
16
|
# File 'lib/isomorfeus_react/lucid_component/app_store_proxy.rb', line 14
def []=(key, value)
method_missing(key, value)
end
|