Sha256: ad4bfa1bd1ba13467c4d619b181327a906bc4bdce16c7a89322b37796e27b1da

Contents?: true

Size: 387 Bytes

Versions: 5

Compression:

Stored size: 387 Bytes

Contents

# frozen_string_literal: true

module Glob
  module SymbolizeKeys
    def self.call(target)
      case target
      when Hash
        target.each_with_object({}) do |(key, value), buffer|
          buffer[key.to_s.to_sym] = SymbolizeKeys.call(value)
        end
      when Array
        target.map {|item| SymbolizeKeys.call(item) }
      else
        target
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
glob-0.4.1 lib/glob/symbolize_keys.rb
glob-0.4.0 lib/glob/symbolize_keys.rb
glob-0.3.1 lib/glob/symbolize_keys.rb
glob-0.3.0 lib/glob/symbolize_keys.rb
glob-0.2.2 lib/glob/symbolize_keys.rb