Sha256: 476d630ee2b2c7fc71786d89a1200c560484234037f60525103efc25d8a8d2aa
Contents?: true
Size: 812 Bytes
Versions: 5
Compression:
Stored size: 812 Bytes
Contents
require 'yaml' module MooMoo class Config attr_accessor :host attr_accessor :key attr_accessor :username attr_accessor :password attr_accessor :port 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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
moo_moo-0.7.0 | lib/moo_moo/config.rb |
moo_moo-0.6.0 | lib/moo_moo/config.rb |
moo_moo-0.5.0 | lib/moo_moo/config.rb |
moo_moo-0.4.0 | lib/moo_moo/config.rb |
moo_moo-0.3.0 | lib/moo_moo/config.rb |