Sha256: f4aba3063ce3898c115f3efcefc28fb83b5a1645aa22a4d14637b81f9b373707
Contents?: true
Size: 488 Bytes
Versions: 25
Compression:
Stored size: 488 Bytes
Contents
describe "Predefined global $~" do it "is set to contain the MatchData object of the last match if successful" do md = /foo/.match 'foo' $~.should be_kind_of(MatchData) $~.object_id.should == md.object_id /bar/ =~ 'bar' $~.should be_kind_of(MatchData) $~.object_id.should_not == md.object_id end it "is set to nil if the last match was unsuccessful" do /foo/ =~ 'foo' $~.nil?.should == false /foo/ =~ 'bar' $~.nil?.should == true end end
Version data entries
25 entries across 25 versions & 1 rubygems