Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/progress-meter.rb
Instance Method Summary collapse
Instance Method Details
#collect(&block) ⇒ Object
188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/progress-meter.rb', line 188 def collect (&block) if Progress.active? then progress_meters = Progress::progress_meters progress_meters.push(Progress.new(self.stat.size, progress_meters.size )) res = orig_collect {|l| r = block.call(l);progress_meters.last.set(self.pos); r} progress_meters.pop res else orig_collect &block end end |
#each(&block) ⇒ Object
177 178 179 180 181 182 183 184 185 186 |
# File 'lib/progress-meter.rb', line 177 def each (&block) if Progress.active? then progress_meters = Progress::progress_meters progress_meters.push(Progress.new(self.stat.size, progress_meters.size )) orig_each {|l| block.call(l);progress_meters.last.set(self.pos);} progress_meters.pop else orig_each &block end end |
#orig_collect ⇒ Object
176 |
# File 'lib/progress-meter.rb', line 176 alias :orig_collect :collect |
#orig_each ⇒ Object
175 |
# File 'lib/progress-meter.rb', line 175 alias :orig_each :each |