Module: Xqsr3::HashUtilities::DeepTransform

Included in:
Hash
Defined in:
lib/xqsr3/hash_utilities/deep_transform.rb

Instance Method Summary collapse

Instance Method Details

#deep_transform(&block) ⇒ Object

Executes the given mandatory 1- or 2-parameter block on the receiving instance, which must be a Hash or a type that responds to the map message, returning a copy of the instance in which keys (1-parameter block) or keys and values (2-parameter block) are transformed.



131
132
133
134
# File 'lib/xqsr3/hash_utilities/deep_transform.rb', line 131

def deep_transform &block

	DeepTransform.do_deep_transform_on_hashlike_(self, &block)
end

#deep_transform!(&block) ⇒ Object

Note:

This method is not strongly exception-safe - failure during transformation can result in a partially transformed instance

Executes the given mandatory 1- or 2-parameter block on the receiving instance, whihc must be a Hash or a type that responds to [], delete, and keys messages, changing the keys (1-parameter block) or keys and values (2-parameter block).



143
144
145
146
# File 'lib/xqsr3/hash_utilities/deep_transform.rb', line 143

def deep_transform! &block

	do_deep_transform_on_self_(&block)
end