Sha256: 8c7e0bf138523e44f9db323f314593cec3ad3812e862c1062b41efa66c4fadce

Contents?: true

Size: 386 Bytes

Versions: 11

Compression:

Stored size: 386 Bytes

Contents

module Queuel
  class Hash < ::Hash
    def self.new(*args, &block)
      if args.first.is_a?(::Hash)
        allocate.send(:initialize).replace(args.first)
      else
        super *args, &block
      end
    end

    def partition(&block)
      if block_given?
        one, two = super &block
        [Hash[one], Hash[two]]
      else
        super &block
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
queuel-0.4.8 lib/queuel/core_ext/hash.rb
queuel-0.4.6 lib/queuel/core_ext/hash.rb
queuel-0.4.5 lib/queuel/core_ext/hash.rb
queuel-0.4.4 lib/queuel/core_ext/hash.rb
queuel-0.4.3 lib/queuel/core_ext/hash.rb
queuel-0.4.2 lib/queuel/core_ext/hash.rb
queuel-0.4.1 lib/queuel/core_ext/hash.rb
queuel-0.4.0 lib/queuel/core_ext/hash.rb
queuel-0.3.1 lib/queuel/core_ext/hash.rb
queuel-0.3.0 lib/queuel/core_ext/hash.rb
queuel-0.2.0 lib/queuel/core_ext/hash.rb