Class: Phut::Setting
- Inherits:
-
Object
- Object
- Phut::Setting
- Defined in:
- lib/phut/setting.rb
Overview
Central configuration repository.
Constant Summary collapse
- DEFAULTS =
{ root: File.(File.join(File.dirname(__FILE__), '..', '..')), logger: Logger.new($stderr).tap do |logger| logger.formatter = proc { |_sev, _dtm, _name, msg| msg + "\n" } logger.level = Logger::INFO end, pid_dir: Dir.tmpdir, log_dir: Dir.tmpdir, socket_dir: Dir.tmpdir }.freeze
Instance Method Summary collapse
-
#initialize ⇒ Setting
constructor
A new instance of Setting.
- #log_dir ⇒ Object
- #log_dir=(path) ⇒ Object
- #logger ⇒ Object
- #logger=(logger) ⇒ Object
- #pid_dir ⇒ Object
- #pid_dir=(path) ⇒ Object
- #root ⇒ Object
- #socket_dir ⇒ Object
- #socket_dir=(path) ⇒ Object
Constructor Details
Instance Method Details
#log_dir ⇒ Object
46 47 48 |
# File 'lib/phut/setting.rb', line 46 def log_dir @options.fetch :log_dir end |
#log_dir=(path) ⇒ Object
50 51 52 53 |
# File 'lib/phut/setting.rb', line 50 def log_dir=(path) raise "No such directory: #{path}" unless FileTest.directory?(path) @options[:log_dir] = File.(path) end |
#logger ⇒ Object
29 30 31 |
# File 'lib/phut/setting.rb', line 29 def logger @options.fetch :logger end |
#logger=(logger) ⇒ Object
33 34 35 |
# File 'lib/phut/setting.rb', line 33 def logger=(logger) @options[:logger] = logger end |
#pid_dir ⇒ Object
37 38 39 |
# File 'lib/phut/setting.rb', line 37 def pid_dir @options.fetch :pid_dir end |
#pid_dir=(path) ⇒ Object
41 42 43 44 |
# File 'lib/phut/setting.rb', line 41 def pid_dir=(path) raise "No such directory: #{path}" unless FileTest.directory?(path) @options[:pid_dir] = File.(path) end |
#root ⇒ Object
25 26 27 |
# File 'lib/phut/setting.rb', line 25 def root @options.fetch :root end |
#socket_dir ⇒ Object
55 56 57 |
# File 'lib/phut/setting.rb', line 55 def socket_dir @options.fetch :socket_dir end |
#socket_dir=(path) ⇒ Object
59 60 61 62 |
# File 'lib/phut/setting.rb', line 59 def socket_dir=(path) raise "No such directory: #{path}" unless FileTest.directory?(path) @options[:socket_dir] = File.(path) end |