Class: Enumerable::Progress
- Defined in:
- lib/vex/base/enumerable/progress.rb,
lib/vex/base/enumerable/progress.rb
Direct Known Subclasses
Constant Summary collapse
- IMPLEMENTATIONS =
{ :console => ConsoleProgress }
Instance Method Summary collapse
-
#initialize(base, count = nil) ⇒ Progress
constructor
A new instance of Progress.
- #method_missing(sym, *args) ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/vex/base/enumerable/progress.rb', line 10 def method_missing(sym, *args) return @base.send(sym, *args) unless block_given? r = @base.send sym, *args do |*args| begin yield *args ensure @idx += 1 on_progress(@idx, @count) end end end |