Class: HyperStore::StateWrapper
- Inherits:
-
BaseStoreClass
- Object
- BaseStoreClass
- HyperStore::StateWrapper
show all
- Defined in:
- lib/react/state_wrapper.rb
Overview
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/react/state_wrapper.rb', line 14
def method_missing(method, *args)
if method.end_with?('!') && __from__.respond_to?(:deprecation_warning)
__from__.deprecation_warning("The mutator 'state.#{method}' has been deprecated. Use 'mutate.#{method.sub(/\!$/,'')}' instead.")
__from__.mutate.__send__(method.chop, *args)
else
pre_component_method_missing(method, *args)
end
end
|
Instance Method Details
#[](state) ⇒ Object
4
5
6
|
# File 'lib/react/state_wrapper.rb', line 4
def [](state)
`#{__from__.instance_variable_get('@native')}.state[#{state}] || #{nil}`
end
|
#[]=(state, new_value) ⇒ Object
8
9
10
|
# File 'lib/react/state_wrapper.rb', line 8
def []=(state, new_value)
`#{__from__.instance_variable_get('@native')}.state[#{state}] = new_value`
end
|
#pre_component_method_missing ⇒ Object
12
|
# File 'lib/react/state_wrapper.rb', line 12
alias pre_component_method_missing method_missing
|