Sha256: 71801438c14e56eda9f965fcdc29614b7d7da5019a8d21991dd408c5de174d21
Contents?: true
Size: 434 Bytes
Versions: 15
Compression:
Stored size: 434 Bytes
Contents
describe "Array#select" do it "returns a new array of elements for which block is true" do [1, 3, 4, 5, 6, 9].select { |i| i.odd? }.should == [1, 3, 5, 9] [1, 2, 3, 4, 5, 6].select { true }.should == [1, 2, 3, 4, 5, 6] [1, 2, 3, 4, 5, 6].select { false }.should == [] end end describe "Array#select!" do it "returns nil if no changes were made in the array" do [1, 2, 3].select! { true }.should be_nil end end
Version data entries
15 entries across 15 versions & 1 rubygems