Sha256: 94afcfcb4561fa7b06f3c1f5e67ecd59ffd3bc995d0c32f3cb0ddcad3253f432
Contents?: true
Size: 655 Bytes
Versions: 1
Compression:
Stored size: 655 Bytes
Contents
module BookmeterScraper class Configuration attr_accessor :mail, :password def initialize(config_file = nil) if config_file.nil? @mail = @password = '' return end config = load_yaml_file(config_file) unless config.has_key?('mail') && config.has_key?('password') raise ConfigurationError, "#{config_file}: Invalid configuration file" end @mail = config['mail'] @password = config['password'] end private def load_yaml_file(config_file) require 'yaml' YAML.load_file(config_file) end end class ConfigurationError < StandardError; end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bookmeter_scraper-0.1.2 | lib/bookmeter_scraper/configuration.rb |