Sha256: ea563f53a16e0109dcd88657ca1f801337a25a9565aa6545cc6375405a2d6af7
Contents?: true
Size: 669 Bytes
Versions: 6
Compression:
Stored size: 669 Bytes
Contents
module ElabsMatchers module Helpers module NormalizeKeys rspec ## # # Normalizes a hash so that it can be described in a more # human friendly manner. # # @param [Hash] hash A hash of human-friendly key and value pairs. # # Examples: # # # Or in a Cucumber table: # Given the following people: # | First name | Last name | # | Douglas | Adams | def normalize_keys(hash) hash.inject(HashWithIndifferentAccess.new) do |new_hash, (key, value)| new_hash[key.parameterize("_")] = value new_hash end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems