lib/spacebunny/utils.rb
# support methods for deep transforming nested hashes and arrays
support methods for deep transforming nested hashes and arrays
support methods for deep transforming nested hashes and arrays
def _deep_transform_keys_in_object(object, &block)
    case object
      when Hash
        object.each_with_object({}) do |(key, value), result|
          result[yield(key)] = _deep_transform_keys_in_object(value, &block)
        end
      when Array
        object.map {|e| _deep_transform_keys_in_object(e, &block) }
      else
        object
    end
  end
def _deep_transform_keys_in_object ( object , & block ) case object when Hash object . each_with_object ( { } ) do | ( key , value ) , result | result [ yield ( key ) ] = _deep_transform_keys_in_object ( value , & block ) end when Array object . map { | e | _deep_transform_keys_in_object ( e , & block ) } else object end end
support methods for deep transforming nested hashes and arrays
support methods for deep transforming nested hashes and arrays
object
block