Sha256: 0eba14984eb6d724045b343487517ef2c1ec8492c3bb0f3572f395e3c85db987
Contents?: true
Size: 362 Bytes
Versions: 3
Compression:
Stored size: 362 Bytes
Contents
describe "Block parameters" do it "does not override a shodowed variable from the outer scope" do i = 0 a = [1, 2, 3] a.each { |i| ;} i.should == 0 end it "captures variables from the outer scope" do a = [1, 2, 3] sum = 0 vari = nil a.each { |vari| sum = sum + vari } sum.should == 6 vari.should == nil end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opal-0.2.2 | opals/opal/opal/spec/language/block_spec.rb |
opal-0.2.0 | opals/opal/opal/spec/language/block_spec.rb |
opal-0.1.0 | opals/opal/spec/language/block_spec.rb |