Sha256: ffc66dde054b2608b546f7ae0f9493100ed6525938840a0fce8249ba588e2836

Contents?: true

Size: 278 Bytes

Versions: 1

Compression:

Stored size: 278 Bytes

Contents

module ObjectHelper
  module Array
    unless method_defined? :to_hash_with_array
      def to_hash_with_array
        return {} if empty?

        each_with_object({}) do |(key, value), result|
          (result[key] ||= []).push(value)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
object_helper-0.1.0 lib/object_helper/array.rb