Class: MechanizeProgressBar
- Inherits:
-
Object
- Object
- MechanizeProgressBar
- Defined in:
- lib/mechanize/progressbar/mechanize_progressbar.rb
Overview
:nodoc:
Class Method Summary collapse
Instance Method Summary collapse
- #finish ⇒ Object
- #inc(step) ⇒ Object
-
#initialize(mech, request, response) ⇒ MechanizeProgressBar
constructor
A new instance of MechanizeProgressBar.
- #suppress_logger? ⇒ Boolean
Constructor Details
#initialize(mech, request, response) ⇒ MechanizeProgressBar
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/mechanize/progressbar/mechanize_progressbar.rb', line 19 def initialize(mech, request, response) = mech. self.class.unregister(mech) if ['reset!'] _first_time = .empty? _unusual_response = response.code != '200' case when _first_time, _unusual_response = nil else = (, request, response) end if mech.log log_output = mech.log.instance_variable_get(:@logdev).dev = .instance_variable_get(:@out) @suppress_logger = true if log_output == end @suppress_logger = [:suppress_logger] if .has_key?(:suppress_logger) end |
Class Method Details
.register(mech, pbar_opts) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/mechanize/progressbar/mechanize_progressbar.rb', line 3 def self.register(mech, ) unregister(mech) mech..update() reset_reservation = mech.['reserve!'] mech.['reset!'] = reset_reservation end |
.unregister(mech) ⇒ Object
11 12 13 |
# File 'lib/mechanize/progressbar/mechanize_progressbar.rb', line 11 def self.unregister(mech) mech..clear end |
.unregister_next_init(mech) ⇒ Object
15 16 17 |
# File 'lib/mechanize/progressbar/mechanize_progressbar.rb', line 15 def self.unregister_next_init(mech) mech.['reserve!'] = true end |
Instance Method Details
#finish ⇒ Object
46 47 48 |
# File 'lib/mechanize/progressbar/mechanize_progressbar.rb', line 46 def finish .finish if end |
#inc(step) ⇒ Object
42 43 44 |
# File 'lib/mechanize/progressbar/mechanize_progressbar.rb', line 42 def inc(step) .inc(step) if end |
#suppress_logger? ⇒ Boolean
50 51 52 |
# File 'lib/mechanize/progressbar/mechanize_progressbar.rb', line 50 def suppress_logger? @suppress_logger end |