Class: Dry::Effects::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/effects/handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, *args) ⇒ Handler

Returns a new instance of Handler.



10
11
12
13
# File 'lib/dry/effects/handler.rb', line 10

def initialize(type, *args)
  @provider = ::Dry::Effects.providers[type].new(*args)
  @frame = Frame.new(provider)
end

Instance Attribute Details

#frameObject (readonly)

Returns the value of attribute frame.



8
9
10
# File 'lib/dry/effects/handler.rb', line 8

def frame
  @frame
end

#providerObject (readonly)

Returns the value of attribute provider.



6
7
8
# File 'lib/dry/effects/handler.rb', line 6

def provider
  @provider
end

Instance Method Details

#callObject



15
16
17
# File 'lib/dry/effects/handler.rb', line 15

def call(...)
  frame.(...)
end

#to_sObject Also known as: inspect



19
20
21
# File 'lib/dry/effects/handler.rb', line 19

def to_s
  "#<Dry::Effects::Handler #{provider.represent}>"
end