Class: Statistics
- Inherits:
-
Object
- Object
- Statistics
- Defined in:
- lib/gsv_downloader/statistics.rb
Overview
Optional Statistics
-
number of processed events
-
speed/seconds
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize ⇒ Statistics
constructor
A new instance of Statistics.
- #processed ⇒ Object
- #reset_speed_session ⇒ Object
- #speed ⇒ Object
Constructor Details
#initialize ⇒ Statistics
Returns a new instance of Statistics.
5 6 7 8 |
# File 'lib/gsv_downloader/statistics.rb', line 5 def initialize() @processed = 0 reset_speed_session end |
Instance Method Details
#count ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/gsv_downloader/statistics.rb', line 24 def count if (@processed % 100) == 0 puts "#{@processed} GSV Images processed (speed: #{speed}/s)" reset_speed_session end @processed += 1 @session_count += 1 end |
#processed ⇒ Object
10 11 12 |
# File 'lib/gsv_downloader/statistics.rb', line 10 def processed @processed end |
#reset_speed_session ⇒ Object
14 15 16 17 |
# File 'lib/gsv_downloader/statistics.rb', line 14 def reset_speed_session @start_time = Time.now @session_count = 0 end |
#speed ⇒ Object
19 20 21 22 |
# File 'lib/gsv_downloader/statistics.rb', line 19 def speed time = Time.now - @start_time @session_count.to_f / time.to_f end |