Class: Mayu::State::ActionCreator::Base

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mayu/state/action_creator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Base

Returns a new instance of Base.



18
19
20
# File 'lib/mayu/state/action_creator.rb', line 18

def initialize(type)
  @type = type
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



15
16
17
# File 'lib/mayu/state/action_creator.rb', line 15

def type
  @type
end

Instance Method Details

#===(other) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/mayu/state/action_creator.rb', line 32

def ===(other)
  case other
  when Hash
    @type == other[:type]
  when ActionWrapper
    @type == other.type
  else
    super
  end
end

#call(payload = nil) ⇒ Object



27
28
29
# File 'lib/mayu/state/action_creator.rb', line 27

def call(payload = nil)
  { type:, payload: }
end