My use case is for a long-running ruby service. As such symbols as keys tend to "leak" memory over time if enough new symbols are seen as the ruby GC does not free these refs.
When hash keys are however strings the GC does not bloat as much over time so it would be very useful for certain use cases to specify the type used (string | symbol) for hash keys instead of defaulting to symbols.
I currently use this monkey patch to modify xmlhasher's behaviour for me:
module XmlHasher
module Util
def self.snakecase(str)
str.to_s.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z])([A-Z])/, '\1_\2').downcase.tr('-', '_')
end
end
end
This is of course not ideal and support for this in the lib itself makes more sense.
My use case is for a long-running ruby service. As such symbols as keys tend to "leak" memory over time if enough new symbols are seen as the ruby GC does not free these refs.
When hash keys are however strings the GC does not bloat as much over time so it would be very useful for certain use cases to specify the type used (string | symbol) for hash keys instead of defaulting to symbols.
I currently use this monkey patch to modify xmlhasher's behaviour for me:
This is of course not ideal and support for this in the lib itself makes more sense.