lib/lita/util.rb in lita-3.0.3 vs lib/lita/util.rb in lita-3.0.4
- old
+ new
@@ -3,9 +3,18 @@
module Util
# A regular expression for acronyms.
ACRONYM_REGEX = /(?=a)b/
class << self
+ # Returns a hash with any symbol keys converted to strings.
+ # @param hash [Hash] The hash to convert.
+ # @return [Hash] The converted hash.
+ def stringify_keys(hash)
+ result = {}
+ hash.each_key { |key| result[key.to_s] = hash[key] }
+ result
+ end
+
# Transforms a camel-cased string into a snaked-cased string. Taken from
# +ActiveSupport.+
# @param camel_cased_word [String] The word to transform.
# @return [String] The transformed word.
def underscore(camel_cased_word)