Sha256: 59ccf7f98edd85914430d933a55f6d32b5daf4f680fa353cc627b6ffaa2d331b
Contents?: true
Size: 838 Bytes
Versions: 2
Compression:
Stored size: 838 Bytes
Contents
require 'yaml' module MooMoo class Config attr_accessor :host attr_accessor :key attr_accessor :username attr_accessor :password attr_accessor :port attr_accessor :logger def initialize @host = default_option("host") || 'horizon.opensrs.net' @key = default_option("key") @username = default_option("username") @password = default_option("password") @port = default_option("port") end private def options_file_name ".moomoo.yml" end # Retrieves default options coming from a configuration file, if any. def default_option(key) @yaml ||= begin if File.exists?(options_file_name) YAML.load(File.open(options_file_name)) else {} end end @yaml[key.to_s] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
moo_moo-0.9.0 | lib/moo_moo/config.rb |
moo_moo-0.8.0 | lib/moo_moo/config.rb |