Class: Array

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

Instance Method Summary collapse

Instance Method Details

#binaryObject



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

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

#paramifyObject



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

def paramify
  hash = Hash.new

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

  hash
end