From: daz Date: 2005-10-05T23:21:52+09:00 Subject: Re: caller limux... wrote: > > the follow code is in the mkmf.rb: > > *def checking_for(m) > f = caller[0][/in `(.*)'$/, 1] and f << ": " #` for vim > m = "checking for #{m}... " > message "%s", m > a = r = nil > Logging::postpone do > r = yield > a = r ? "yes\n" : "no\n" > "#{f}#{m}-------------------- #{a}\n" > end > message(a) > Logging::message "--------------------\n\n" > r > end > > *what meaning of the '*f = caller[0][/in `(.*)'$/, 1] and f << ": " #` for vim*'? > def metha methb end def methb sep; p(( f = caller )) # Execution history (Array) sep; p(( f = caller[0] )) # Take the most recent entry # Take the first group from a string match result (else nil) # See [1] sep; p(( f = caller[0][/in `(.*)'$/, 1] )) # If there was a match, append ': ' to it sep; p(( f = caller[0][/in `(.*)'$/, 1] and f << ": " )) # The rest is a comment end def sep; puts('-' * 30) end metha ##-> ------------------------------ ##-> ["C:/TEMP/rbB105.TMP:2:in `metha'", "C:/TEMP/rbB105.TMP:17"] ##-> ------------------------------ ##-> "C:/TEMP/rbB105.TMP:2:in `metha'" ##-> ------------------------------ ##-> "metha" ##-> ------------------------------ ##-> "metha: " [1] str[regexp, fixnum] http://www.ruby-doc.org/core/classes/String.html#M001373 daz