Sha256: ffb1ab8744bb77a569844e2aa2cf7bf0c5f69cac80d3ef36e2fc4d4fa2c68efd

Contents?: true

Size: 259 Bytes

Versions: 7

Compression:

Stored size: 259 Bytes

Contents

module Enumerable
  # %w{A C G T}.collect_hash{|k| [k*2, k*3] }
  # # ==> {"AA" => "AAA", "CC" => "CCC", "GG" => "GGG", "TT" => "TTT"}
  def collect_hash(&block)
    block_given?  ?  Hash[ collect(&block) ]  :  Hash[ collect{|k,v| [k,v]} ]    
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bioinform-0.1.6 lib/bioinform/support/collect_hash.rb
bioinform-0.1.5 lib/bioinform/support/collect_hash.rb
bioinform-0.1.4 lib/bioinform/support/collect_hash.rb
bioinform-0.1.3 lib/bioinform/support/collect_hash.rb
bioinform-0.1.2 lib/bioinform/support/collect_hash.rb
bioinform-0.1.1 lib/bioinform/support/collect_hash.rb
bioinform-0.1.0 lib/bioinform/support/collect_hash.rb