class Dry::Effects::Providers::Reader
Constants
- Any
Attributes
state[R]
Public Class Methods
handle_method(scope, as: Undefined, **)
click to toggle source
# File lib/dry/effects/providers/reader.rb, line 9 def self.handle_method(scope, as: Undefined, **) Undefined.default(as) { :"with_#{scope}" } end
new(*, **)
click to toggle source
Calls superclass method
# File lib/dry/effects/providers/reader.rb, line 27 def initialize(*, **) super @state = Undefined end
Public Instance Methods
call(state) { || ... }
click to toggle source
Yield the block with the handler installed
@api private
# File lib/dry/effects/providers/reader.rb, line 40 def call(state) case state when state_type @state = state yield else raise Errors::InvalidValueError.new(state, scope) end end
provide?(effect)
click to toggle source
@return [Boolean] @api public
# File lib/dry/effects/providers/reader.rb, line 62 def provide?(effect) effect.type.equal?(:state) && effect.name.equal?(:read) && scope.equal?(effect.scope) end
read()
click to toggle source
# File lib/dry/effects/providers/reader.rb, line 33 def read state end
represent()
click to toggle source
@return [String] @api public
# File lib/dry/effects/providers/reader.rb, line 52 def represent if Undefined.equal?(state) "#{type}[#{scope} not set]" else "#{type}[#{scope} set]" end end