Hamilton::Storage
Storage class for Hamilton::Context. Basically, it's a hidden Hash(Symbol, Hamilton::Any)
with some methods being overridden (same behavior as in Hash) without the need for explicit convertion values to Hamilton::Any.
Constructors
Instance methods
Assignes value to a key. Raises an ArgumentError if something goes wrong (wrong type of value).
Deletes the key-value pair and returns the value, else yields key with given block.
Returns the value for the key, or when not found the value given by default.
Raises an ArgumentError if something goes wrong (wrong type of default).
Returns the value for the key, or when not found the value returned by the given block invoked with key.
Raises an ArgumentError if something goes wrong (wrong type of block's result).
Tries to set value to a key. Raises an ArgumentError if something goes wrong (wrong type of value).
If a value already exists for key, that (old) value is returned.
Otherwise the given block is invoked with key and its value is returned.
Tries to set value to a key if it's absent yet. Raises an ArgumentError if something goes wrong (wrong type of value).
If a value already exists for key, that (old) value is returned.
Otherwise value is returned.
Tries to set the result of the given block to a key if it's absent yet.
Raises an ArgumentError if something goes wrong (wrong type of block's result).
If a value already exists for key, that (old) value is returned.
Otherwise the given block is invoked with key and its value is returned.
Returns an Array of Tuple(Symbol, Hamilton::Any) with keys and values belonging to this Storage.