Tuesday, 6 August 2013

What does #{...} mean?

What does #{...} mean?

Such as in the following code from 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

No comments:

Post a Comment