class MooMoo::Config

Attributes

host[RW]
key[RW]
logger[RW]
port[RW]
username[RW]

Public Class Methods

new() click to toggle source
# File lib/moo_moo/config.rb, line 11
def initialize
  @host     = default_option("host") || 'horizon.opensrs.net'
  @key      = default_option("key")
  @username = default_option("username")
  @port     = default_option("port")
end

Private Instance Methods

default_option(key) click to toggle source

Retrieves default options coming from a configuration file, if any.

# File lib/moo_moo/config.rb, line 25
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
options_file_name() click to toggle source
# File lib/moo_moo/config.rb, line 20
def options_file_name
  ".moomoo.yml"
end