Class: Mayu::State::ActionCreator::PreparedActionCreator

Inherits:
Base
  • Object
show all
Defined in:
lib/mayu/state/action_creator.rb

Constant Summary collapse

ProcType =
T.type_alias { T.proc.returns(Store::ActionHash) }

Instance Attribute Summary

Attributes inherited from Base

#type

Instance Method Summary collapse

Methods inherited from Base

#===

Constructor Details

#initialize(type, &block) ⇒ PreparedActionCreator



53
54
55
56
# File 'lib/mayu/state/action_creator.rb', line 53

def initialize(type, &block)
  super(type)
  @prepare = block
end

Instance Method Details

#call(*args, **kwargs) ⇒ Object



61
62
63
# File 'lib/mayu/state/action_creator.rb', line 61

def call(*args, **kwargs)
  { type: }.merge(T.unsafe(@prepare).call(*args, **kwargs))
end