[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:03863] Re: Array.uniq! returning nil

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-07-06 10:25:14 UTC
List: ruby-talk #3863
How much code would break by having an optional third argument, defaulting
to current behaviour?

def sub!(pattern, substitution, no_change_gives=nil)
    #...
end

then you could have

astring.sub!(/wine/, "beer", astring)

so the unchanged string gets passed on if there is no change, or 

astring.sub!(/wine/, "beer", "vodka")

or whatever.

	Hugh


In This Thread