Sha256: 2907b60d149f75e59184295debe8d1ddc2e4bfef8bf54b9b16894bfeffca24f4

Contents?: true

Size: 340 Bytes

Versions: 3

Compression:

Stored size: 340 Bytes

Contents

module Flapjack
  module Diner
    module Utility
      def self.symbolize(obj)
        case obj
        when Hash
          obj.each_with_object({}) {|(k, v), a| a[k.to_sym] = symbolize(v) }
        when Array
          obj.each_with_object([]) {|e, a| a << symbolize(e) }
        else
          obj
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flapjack-diner-2.0.0 lib/flapjack-diner/utility.rb
flapjack-diner-2.0.0b1 lib/flapjack-diner/utility.rb
flapjack-diner-2.0.0.a4 lib/flapjack-diner/utility.rb