public
Description: This plugin is an assortment of classes and patches to classes that are considered useful by us to be added to most/all projects
Clone URL: git://github.com/bwyrosdick/common-plugin.git
Fixed bad String#convert side effect.
Fri Jul 11 06:35:41 -0700 2008
commit  25518871f4da4fb2efd6cf07f3c8a7c1ad9b0b2e
tree    ca8b57e04085da4d4578feb783b1e3445aa17039
parent  7c307f7958dbf7ad656852a5640e918f078f4886
...
1
2
3
4
5
 
 
6
7
8
...
1
2
 
 
 
3
4
5
6
7
0
@@ -1,8 +1,7 @@
0
 class String
0
   def convert(pattern, template)
0
- output = template
0
- matches = self.match(pattern)
0
- matches.to_a.each_with_index{|m, i| output.gsub!("$#{i}", m)}
0
+ output = String.new(template)
0
+ self.match(pattern).to_a.each_with_index{|group, index| output.gsub!("$#{index}", group)}
0
     output
0
   end
0
 

Comments

    No one has commented yet.