Sha256: 61246997350c9287cf602f765027e8cb8f6d5496127abd1a152ea0d9d0401a1f
Contents?: true
Size: 643 Bytes
Versions: 8
Compression:
Stored size: 643 Bytes
Contents
require 'spec_helper' require 'bioinform/support/collect_hash' describe Enumerable do # %w{A C G T}.collect_hash{|k| [k*2, k*3] } # # ==> {"AA" => "AAA", "CC" => "CCC", "GG" => "GGG", "TT" => "TTT"} context '#collect_hash' do it 'should take a block and create a hash from collected [k,v] pairs' do %w{A C G T}.collect_hash{|k| [k*2, k*3] }.should == {"AA" => "AAA", "CC" => "CCC", "GG" => "GGG", "TT" => "TTT"} end it 'should create a hash from yielded [k,v] pairs if block not given' do %w{A C G T}.each_with_index.collect_hash.should == {"A" => 0, "C" => 1, "G" => 2, "T" => 3} end end end
Version data entries
8 entries across 8 versions & 1 rubygems