Purpose
Hoodoo includes a grab-bag of utility methods used internally to keep its footprint, including external dependencies, to a minimum. These methods are part of the public API and covered by RDoc. This Guide lists the facilities available in groups, making them easier to discover.
It is generally recommended that service authors use Hoodoo utility methods where possible to help ensure consistent behaviour across the system.
Hashes
Creation
collated_hash_from
– build a Hash from an Array, allowing duplicate entriesdeep_dup
– duplicate a Hash and any nested Hashesstringify
– convert keys to Stringssymbolize
– convert keys to Symbols
Modification
deep_merge_into
– merge one Hash into another, including any nested Hashes
Comparison and access
hash_diff
– compare two Hasheshash_key_paths
– extract the key paths for a Hash and any nested Hashes into a flat Array
Date and time
Conversion
nanosecond_iso8601
– consistent rendering of a Time or DateTime with nanosecond precisionrationalise_datetime
– convert various forms of input representation into a DateTime instance
Validation
valid_iso8601_subset_date?
– see if a String describing a date conforms to the Hoodoo ISO 8601 subsetvalid_iso8601_subset_datetime?
– see if a String describing a date and time conforms to the Hoodoo ISO 8601 subset
Miscellaneous
spare_port
– find a spare TCP port onlocalhost
to_integer?
– check to see if an input quantity will convert to an Integer without loss or ignored characters