From: Robert Klemme Date: 2004-08-23T16:20:55+09:00 Subject: Re: Regexp scanning with MatchData (Re: multiple regexp matches) "Austin Ziegler" schrieb im Newsbeitrag news:9e7db911040822170976892f3b@mail.gmail.com... > Yet another alternative is to add an optional parameter in all cases. > String#gsub currently expects a regexp and a replace pattern OR a > regexp and a block. #gsub could be modified such that when it gets a > regexp, a "boolean", and a block, it yields something different. This > could be, for example: Adding a flag to change method behavior is usually regarded bad OO practice. The usual solution is to have two different methods - one for each behavior. That increases modularity, simplifies the implementation and improves performance. I'd rather have String#gsub_md, String#gsub_md! and String#scan_md than the flag although I have to admit that those method names are ugly. Kind regards robert