Sha256: a5d1838e8ed657fd8bc44377d6b168af71f92b6f639027484dff1c1c0cffbb4c

Contents?: true

Size: 594 Bytes

Versions: 2

Compression:

Stored size: 594 Bytes

Contents

class Hash
  alias_method :undecorated_get, :[]
  def [](key)
    undecorated_get(key) or undecorated_get(key.is_a?(String) ? key.to_sym : key.to_s)
  end
end

def load_settings(defaults_key, defaults)
  config_file_path = File.expand_path("~/.webstats_clients")

  $settings = {}

  if File.exists?(config_file_path)
    $settings = YAML.load(IO.read(config_file_path))
  else
    $settings[defaults_key] = defaults

    File.open(config_file_path, "w") do |f|
      YAML.dump($settings, f)
    end

    puts "Please edit ~/.webstats_clients and add some URLs to monitor"
    exit
  end
end
  

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bloopletech-webstats-0.5.0 clients/common.rb
bloopletech-webstats-0.6.0 clients/common.rb