Class: Rmpd::Config
- Inherits:
-
Object
- Object
- Rmpd::Config
- Defined in:
- lib/rmpd/config.rb
Constant Summary collapse
- DEFAULT_HOSTNAME =
"localhost"
- DEFAULT_PORT =
6600
- DEFAULT_PASSWORD =
nil
Instance Attribute Summary collapse
-
#hostname ⇒ Object
(also: #host)
Returns the value of attribute hostname.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(config_file = nil) ⇒ Config
constructor
A new instance of Config.
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
#hostname ⇒ Object Also known as: host
Returns the value of attribute hostname.
12 13 14 |
# File 'lib/rmpd/config.rb', line 12 def hostname @hostname end |
#password ⇒ Object
Returns the value of attribute password.
12 13 14 |
# File 'lib/rmpd/config.rb', line 12 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
12 13 14 |
# File 'lib/rmpd/config.rb', line 12 def port @port end |