Class: Array

Inherits:
Object show all
Defined in:
lib/commercebank/monkey.rb

Instance Method Summary collapse

Instance Method Details

#binaryObject



8
9
10
# File 'lib/commercebank/monkey.rb', line 8

def binary
  map {|e| yield(e) ? [e, nil] : [nil, e]}.transpose.map {|a| a.compact}
end

#paramifyObject



12
13
14
15
16
17
18
19
# File 'lib/commercebank/monkey.rb', line 12

def paramify
  hash = Hash.new

  hash.merge! pop if last.kind_of? Hash
  each {|e| hash[e] = true}

  hash
end