Class: Rmpd::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/rmpd/config.rb

Constant Summary collapse

DEFAULT_HOSTNAME =
"localhost"
DEFAULT_PORT =
6600
DEFAULT_PASSWORD =
nil

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_file = nil) ⇒ Config

Returns a new instance of Config.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rmpd/config.rb', line 15

def initialize(config_file=nil)
  case config_file
  when String, Pathname
    config = YAML::load_file(config_file)
  when File, StringIO
    config = YAML::load(config_file)
  else
    config = {}
  end
  puts "env: #{detected_env}" if env_detected? && $DEBUG
  config = config[detected_env] if env_detected?
  puts "config: #{config.inspect}" if $DEBUG
  init_host_and_password(config)
  init_port(config)
end

Instance Attribute Details

#hostnameObject Also known as: host

Returns the value of attribute hostname.



12
13
14
# File 'lib/rmpd/config.rb', line 12

def hostname
  @hostname
end

#passwordObject

Returns the value of attribute password.



12
13
14
# File 'lib/rmpd/config.rb', line 12

def password
  @password
end

#portObject

Returns the value of attribute port.



12
13
14
# File 'lib/rmpd/config.rb', line 12

def port
  @port
end