Class: Hash
Overview
Hash helpers
Instance Method Summary collapse
- #clone ⇒ Object
-
#deep_freeze ⇒ Object
Freeze all values in a hash.
- #deep_freeze! ⇒ Object
-
#deep_set(path, value) ⇒ Object
Set a nested hash value using an array.
- #deep_thaw ⇒ Object
- #deep_thaw! ⇒ Object
-
#delete_unless_key(key, to_delete) ⇒ Object
Delete array of keys unless key exists.
-
#remove_empty ⇒ Object
Remove keys with empty values.
-
#rename_key(old_key, new_key, keep: false) ⇒ Object
Rename a key, deleting old key.
-
#rename_keys(*pairs) ⇒ Object
Rename keys in batch.
-
#stringify_keys ⇒ Hash
Turn all keys into string.
-
#stringify_values ⇒ Hash
Turn all non-numeric values into strings.
-
#symbolize_keys ⇒ Hash
Turn all keys into symbols.
- #tag_filter_to_options ⇒ Object
-
#to_view ⇒ Hash
Convert an options hash to a view config.
Instance Method Details
#clone ⇒ Object
#deep_freeze ⇒ Object
Freeze all values in a hash
#deep_freeze! ⇒ Object
#deep_set(path, value) ⇒ Object
Set a nested hash value using an array
#deep_thaw ⇒ Object
#deep_thaw! ⇒ Object
#delete_unless_key(key, to_delete) ⇒ Object
Delete array of keys unless key exists
#remove_empty ⇒ Object
Remove keys with empty values
#rename_key(old_key, new_key, keep: false) ⇒ Object
Rename a key, deleting old key
#rename_keys(*pairs) ⇒ Object
Rename keys in batch
#stringify_keys ⇒ Hash
Turn all keys into string
If the hash has both a string and a symbol for key, keep the string value, discarding the symnbol value
#stringify_values ⇒ Hash
Turn all non-numeric values into strings
#symbolize_keys ⇒ Hash
Turn all keys into symbols
If the hash has both a string and a symbol for a key, keep the symbol value and discard the string value
#tag_filter_to_options ⇒ Object
#to_view ⇒ Hash
Convert an options hash to a view config