Sha256: 8831ed1268668883e8d11dfc41ccb5ec3a36342748f1ea1de892e7b093268194
Contents?: true
Size: 456 Bytes
Versions: 6
Compression:
Stored size: 456 Bytes
Contents
describe "The redo statement" do it "restarts block execution if used within block" do a = [] lambda { a << 1 redo if a.size < 2 a << 2 }.call a.should == [1, 1, 2] end it "re-executes the closest loop" it "re-executes the last step in enumeration" do list = [] [1,2,3].each do |x| list << x break if list.size == 6 redo if x == 3 end list.should == [1,2,3,3,3,3] end end
Version data entries
6 entries across 6 versions & 1 rubygems