Sha256: c10a3016c73c3c6c09f6347c54ceeea4183fffad0963817ad2e1ae4d2d2a1824

Contents?: true

Size: 311 Bytes

Versions: 4

Compression:

Stored size: 311 Bytes

Contents

module Codily
  module Utils
    def self.symbolize_keys(obj)
      case obj
      when Hash
        Hash[
          obj.map do |k, v|
            [k.to_sym, symbolize_keys(v)]
          end
        ]
      when Array
        obj.map { |_| symbolize_keys(_) }
      else
        obj
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
codily-0.3.1 lib/codily/utils.rb
codily-0.3.0 lib/codily/utils.rb
codily-0.2.0 lib/codily/utils.rb
codily-0.1.0.beta lib/codily/utils.rb