Class: Queuel::Hash

Inherits:
Hash
  • Object
show all
Defined in:
lib/queuel/core_ext/hash.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(*args, &block) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/queuel/core_ext/hash.rb', line 3

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

Instance Method Details

#partition(&block) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/queuel/core_ext/hash.rb', line 11

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