Module: EbsSnapper::Ebs::PausingEnumerable
- Defined in:
- lib/ebs_snapper/ebs.rb
Class Method Summary collapse
- .included(base) ⇒ Object
- .pause_time ⇒ Object
- .pause_time=(time) ⇒ Object
- .wrap(enumerable) ⇒ Object
Class Method Details
.included(base) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/ebs_snapper/ebs.rb', line 127 def self.included(base) base.class_eval do if !method_defined?(:orig_each) alias_method :orig_each, :each def each(&block) orig_each(&block) sleep PausingEnumerable.pause_time # we need to slow down our processing.. end end end end |
.pause_time ⇒ Object
123 124 125 |
# File 'lib/ebs_snapper/ebs.rb', line 123 def self.pause_time @pause_time || EbsSnapper::Ebs::DEFAULT_PAUSE_TIME end |
.pause_time=(time) ⇒ Object
119 120 121 |
# File 'lib/ebs_snapper/ebs.rb', line 119 def self.pause_time=(time) @pause_time = time end |
.wrap(enumerable) ⇒ Object
139 140 141 142 143 144 |
# File 'lib/ebs_snapper/ebs.rb', line 139 def self.wrap(enumerable) enumerable.class.module_eval do include PausingEnumerable end enumerable end |