Sha256: 0c26f7fd9f6136ae843e1d4005cc1341217ea426f281698a7b5a94cbf2a91d53

Contents?: true

Size: 751 Bytes

Versions: 15

Compression:

Stored size: 751 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.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
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
hyper-component-0.99.6 lib/react/state_wrapper.rb
hyper-component-0.99.5 lib/react/state_wrapper.rb
hyper-component-0.99.4 lib/react/state_wrapper.rb
hyper-component-0.99.3 lib/react/state_wrapper.rb
hyper-component-0.99.2 lib/react/state_wrapper.rb
hyper-component-0.99.1 lib/react/state_wrapper.rb
hyper-component-0.99.0 lib/react/state_wrapper.rb
hyper-react-1.0.0.lap28 lib/react/state_wrapper.rb
hyper-react-1.0.0.lap27 lib/react/state_wrapper.rb
hyper-react-1.0.0.lap26 lib/react/state_wrapper.rb
hyper-react-1.0.0.lap25 lib/react/state_wrapper.rb
hyper-react-1.0.0.lap24 lib/react/state_wrapper.rb
hyper-react-1.0.0.lap23 lib/react/state_wrapper.rb
hyper-react-1.0.0.lap22 lib/react/state_wrapper.rb
hyper-react-1.0.0.lap21 lib/react/state_wrapper.rb