Changeset 248
- Timestamp:
- 10/31/05 07:42:18 (3 years ago)
- Files:
-
- 1 modified
-
trunk/lib/fm/utils.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/fm/utils.rb
r206 r248 73 73 ### Return the String as a regular expression that will match it. 74 74 def to_re( casefold=false, extended=false ) 75 return Regexp::new( Regexp::quote(self) ) 75 flags = 0 76 flags |= Regexp::IGNORECASE if casefold 77 flags |= Regexp::EXTENDED if extended 78 return Regexp::new( Regexp::quote(self), flags ) 76 79 end 77 80 … … 98 101 end 99 102 103 end 104 105 106 ### Add some stuff to the builtin Integer class. 107 class Integer 108 109 ### Execute the given block +n+ times and return an Array that contains the 110 ### results of each call. The block will be passed the iteration number. 111 def of 112 accum = [] 113 self.times do |i| 114 accum << yield( i ) 115 end 116 return accum 117 end 100 118 end 101 119
