Class: Gonzui::AbstractUpdater

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/gonzui/updater.rb

Direct Known Subclasses

Importer, Remover, Updater

Instance Method Summary collapse

Methods included from Util

assert, assert_equal, assert_equal_all, assert_non_nil, assert_not_reached, benchmark, command_exist?, commify, eprintf, format_bytes, program_name, protect_from_signals, require_command, set_verbosity, shell_escape, unix?, vprintf, windows?, wprintf

Constructor Details

#initialize(config, options = {}) ⇒ AbstractUpdater

Returns a new instance of AbstractUpdater.



19
20
21
22
23
24
25
26
# File 'lib/gonzui/updater.rb', line 19

def initialize(config, options = {})
  @start_time = Time.now
  @dbm = DBM.open(config)
  @config = config
  @ncontents = 0
  @npackages = 0
  @show_progress = options[:show_progress]
end

Instance Method Details

#finishObject



91
92
93
# File 'lib/gonzui/updater.rb', line 91

def finish
  @dbm.close
end

#summaryObject



83
84
85
86
87
88
89
# File 'lib/gonzui/updater.rb', line 83

def summary
  elapsed = Time.now - @start_time
  format = "%d contents of %d packages %s in %.2f sec. (%.2f contents / sec.)\n"
  summary = sprintf(format, @ncontents, @npackages, task_name, elapsed,
                    @ncontents / elapsed)
  return summary
end