Class: Mayu::State::ActionWrapper

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, payload:) ⇒ ActionWrapper

Returns a new instance of ActionWrapper.



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

def initialize(type:, payload:)
  @type = type
  @payload = payload
end

Instance Attribute Details

#payloadObject (readonly)

Returns the value of attribute payload.



11
12
13
# File 'lib/mayu/state/action_wrapper.rb', line 11

def payload
  @payload
end

#typeObject (readonly)

Returns the value of attribute type.



9
10
11
# File 'lib/mayu/state/action_wrapper.rb', line 9

def type
  @type
end

Instance Method Details

#[](key) ⇒ Object



20
# File 'lib/mayu/state/action_wrapper.rb', line 20

def [](key) = @payload[key]

#fetch(key, &block) ⇒ Object



22
# File 'lib/mayu/state/action_wrapper.rb', line 22

def fetch(key, &block) = @payload.fetch(key, &block)

#inspectObject



25
26
27
# File 'lib/mayu/state/action_wrapper.rb', line 25

def inspect
  "#<Action/#{type} payload=#{payload.inspect}>"
end