class

FSM::Context

Inherits Reference < Object

Represents the "extended" context associated with the finite state machine.

Constructors

new(initial_data = {} of String => Any)

Create a new context with optional initial data.

@param initial_data [Hash(String, Any)] Optional initial data to be registered in the context.

Source

Instance methods

get(key : String) : Any

Get the value associated with a key from the context.

@param key [String] The key to retrieve. @return [Any] The value associated with the key.

Source
modify(key : String, &block : Any -> Any)

Modify the value associated with a key in the context using a block.

@param key [String] The key to modify. @yieldparam current_value [Any] The current value associated with the key. @return [Any] The modified value.

Source
set(key : String, value : Any)

Set the value associated with a key in the context.

@param key [String] The key to set. @param value [Any] The value to associate with the key.

Source