Sha256: fc75f11689e7e25d9e393d2179bb9f43dda14d691cab7ff5e44945958014de96
Contents?: true
Size: 765 Bytes
Versions: 3
Compression:
Stored size: 765 Bytes
Contents
require 'yaml' module MooMoo class Config attr_accessor :host attr_accessor :key attr_accessor :username attr_accessor :port attr_accessor :logger def initialize @host = default_option("host") || 'horizon.opensrs.net' @key = default_option("key") @username = default_option("username") @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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
moo_moo-0.12.0 | lib/moo_moo/config.rb |
moo_moo-0.11.0 | lib/moo_moo/config.rb |
moo_moo-0.10.0 | lib/moo_moo/config.rb |