Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
worklog/hash.rb

Instance Method Summary collapse

Instance Method Details

#stringify_keysObject

Convert all keys to strings so that the YAML file can be read from different languages. This is a monkey patch to the Hash class.



18
19
20
21
22
23
24
# File 'worklog/hash.rb', line 18

def stringify_keys
  # Convert all keys to strings.
  # This is useful when the hash is serialized to YAML.
  #
  # @return [Hash] the hash with all keys converted to strings
  map { |k, v| [k.to_s, v] }.to_h
end