class Dry::Effects::Providers::State

Public Instance Methods

call(state = Undefined) click to toggle source

Yield the block with the handler installed

@api private

Calls superclass method
# File lib/dry/effects/providers/state.rb, line 22
def call(state = Undefined)
  r = super
  [self.state, r]
end
provide?(effect) click to toggle source

@param [Effect] effect @return [Boolean] @api public

# File lib/dry/effects/providers/state.rb, line 30
def provide?(effect)
  effect.type.equal?(:state) && scope.equal?(effect.scope)
end
write(value:) click to toggle source
# File lib/dry/effects/providers/state.rb, line 10
def write(value:)
  case value
  when state_type
    @state = value
  else
    Instructions.Raise(Errors::InvalidValueError.new(state, value))
  end
end