Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/progress-meter.rb
Instance Method Summary collapse
Instance Method Details
#collect(&block) ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/progress-meter.rb', line 137 def collect (&block) if Progress.active? then progress_meters = Progress::progress_meters progress_meters.push(Progress.new(self.length, progress_meters.size )) res = orig_collect {|w| r = block.call(w);progress_meters.last.tick; r} progress_meters.pop res else orig_collect &block end end |
#each(&block) ⇒ Object
125 126 127 128 129 130 131 132 133 134 |
# File 'lib/progress-meter.rb', line 125 def each (&block) if Progress.active? then progress_meters = Progress::progress_meters progress_meters.push(Progress.new(self.length, progress_meters.size )) orig_each {|w|block.call(w);progress_meters.last.tick;} progress_meters.pop else orig_each &block end end |
#orig_collect ⇒ Object
136 |
# File 'lib/progress-meter.rb', line 136 alias :orig_collect :collect |
#orig_each ⇒ Object
123 |
# File 'lib/progress-meter.rb', line 123 alias :orig_each :each |