Sha256: 2affe87f1cee1434c359f661ea34108483bc527d4cf7dd6e465b9f06d173605c
Contents?: true
Size: 660 Bytes
Versions: 5
Compression:
Stored size: 660 Bytes
Contents
require_relative '../spec_helper' require_relative '../../lib/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
5 entries across 5 versions & 1 rubygems