module Hunting

Constants

VERSION

Public Class Methods

config() click to toggle source
# File lib/hunting.rb, line 44
def self.config
  @config
end
configure(opts = {}) click to toggle source

Configure through hash

# File lib/hunting.rb, line 26
def self.configure(opts = {})
  opts.each do |key,value|
    if @valid_config_keys.include? key.to_sym
      @config[key.to_sym] = value
    end
  end
  server = @config[:cdm]['server']
  port = @config[:cdm]['port']
  @config[:dmwebservices] = "http://#{server}:#{port}/dmwebservices/index.php?q="
  @config
end
configure_with(path_to_yaml_file) click to toggle source

Configure through yaml file

# File lib/hunting.rb, line 39
def self.configure_with(path_to_yaml_file)
  config = YAML::load(IO.read(path_to_yaml_file))
  configure(config)
end
increment() click to toggle source
# File lib/hunting.rb, line 65
def self.increment
  @progressbar.increment
end
progressbar(type, name, total = nil) click to toggle source
# File lib/hunting.rb, line 48
def self.progressbar(type, name, total = nil)
  length = Hunting.config[:progressbar]['length']
  case type
  when 'repository'
    @progressbar = ProgressBar.create(total: total,
                                      length: length,
                                      format: "Scouting #{name}: %c |%B|")
  when 'collection'
    @progressbar = ProgressBar.create(total: total,
                                      length: length,
                                      format: "Hunting #{name}: %c/%C |%B|")
  else
    @progressbar = ProgressBar.create(length: length,
                                      format: "Trapping #{name}")
  end
end