2

Why's Poignant Guide の次のコードのように:

def wipe_mutterings_from( sentence ) 
     unless sentence.respond_to? :include?
         raise ArgumentError, "cannot wipe mutterings from a #{ sentence.class }"
     end
     while sentence.include? '('
         open = sentence.index( '(' )
         close = sentence.index( ')', open )
         sentence[open..close] = '' if close
     end
end
4

3 に答える 3

4

"#{}"は、Ruby 文字列補間Hereを意味します。答えが多すぎる場合は、を参照してください。

于 2013-08-06T20:38:22.477 に答える