Class: BitBroker::Config

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

Constant Summary collapse

DEFAULT_PATH_CONFIG =
"#{ENV['HOME']}/.bitbroker/config"
DEFAULT_PATH_PID =
"#{ENV['HOME']}/.bitbroker/pid"

Class Method Summary collapse

Class Method Details

.[](param) ⇒ Object



8
9
10
# File 'lib/bitbroker/config.rb', line 8

def self.[](param)
  YAML.load_file(path_config)[param]
end

.path_configObject



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

def self.path_config
  @path_config ||= DEFAULT_PATH_CONFIG
end

.path_pidObject



15
16
17
# File 'lib/bitbroker/config.rb', line 15

def self.path_pid
  @path_pid ||= DEFAULT_PATH_PID
end

.set_config(path) ⇒ Object



19
20
21
22
23
24
# File 'lib/bitbroker/config.rb', line 19

def self.set_config(path)
  unless FileTest.exist? path
    raise InvalidFile path
  end
  @path_config = path
end