Sha256: 1c45e414cf080aeb1650efa6698ec8c03156b7b3e3c1b70fa015235158035a1a

Contents?: true

Size: 756 Bytes

Versions: 8

Compression:

Stored size: 756 Bytes

Contents

module HyperStore
  class StateWrapper < BaseStoreClass # < BasicObject

    def [](state)
      `#{__from__.instance_variable_get('@native')}.state[#{state}] || #{nil}`
    end

    def []=(state, new_value)
      `#{__from__.instance_variable_get('@native')}.state[#{state}] = new_value`
    end

    alias pre_component_method_missing method_missing

    def method_missing(method, *args)
      if method =~ /\!$/ && __from__.respond_to?(:deprecation_warning)
        __from__.deprecation_warning("The mutator 'state.#{method}' has been deprecated.  Use 'mutate.#{method.gsub(/\!$/,'')}' instead.")
        __from__.mutate.__send__(method.gsub(/\!$/,''), *args)
      else
        pre_component_method_missing(method, *args)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hyper-react-0.12.7 lib/react/state_wrapper.rb
hyper-react-0.12.6 lib/react/state_wrapper.rb
hyper-react-0.12.5 lib/react/state_wrapper.rb
hyper-react-0.12.4 lib/react/state_wrapper.rb
hyper-react-0.12.3 lib/react/state_wrapper.rb
hyper-react-0.12.2 lib/react/state_wrapper.rb
hyper-react-0.12.1 lib/react/state_wrapper.rb
hyper-react-0.12.0 lib/react/state_wrapper.rb