Class: Flow::StateProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/flow/state_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(state) ⇒ StateProxy

Returns a new instance of StateProxy.



6
7
8
# File 'lib/flow/state_proxy.rb', line 6

def initialize(state)
  @_state = state
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object

Deprecated.


11
12
13
14
15
16
17
18
19
# File 'lib/flow/state_proxy.rb', line 11

def method_missing(method_name, *arguments, &block)
  return super unless _state.respond_to?(method_name)

  ActiveSupport::Deprecation.warn(
    "Direct state access of `#{method_name}' on #{_state.inspect} will be removed in a future version of flow. "\
    "Use a state accessor instead - for more information see github/freshly/flow/deprecation_notice"
  )
  _state.public_send(method_name, *arguments, &block)
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Deprecated.

Returns:

  • (Boolean)


22
23
24
# File 'lib/flow/state_proxy.rb', line 22

def respond_to_missing?(method_name, include_private = false)
  _state.respond_to?(method_name) || super
end