Class: Ocular::Settings
- Inherits:
-
Object
- Object
- Ocular::Settings
- Includes:
- Singleton
- Defined in:
- lib/ocular/settings.rb
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Class Method Summary collapse
- .find_settings_file_from_system(filename) ⇒ Object
- .get(key) ⇒ Object
- .load_from_file(filename) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Settings
constructor
A new instance of Settings.
Constructor Details
#initialize ⇒ Settings
Returns a new instance of Settings.
11 12 |
# File 'lib/ocular/settings.rb', line 11 def initialize() end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
7 8 9 |
# File 'lib/ocular/settings.rb', line 7 def settings @settings end |
Class Method Details
.find_settings_file_from_system(filename) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ocular/settings.rb', line 14 def self.find_settings_file_from_system(filename) if ENV['OCULAR_SETTINGS'] != nil filename = File.(ENV['OCULAR_SETTINGS']) end if !filename or !File.exists?(filename) filename = File.('~/.ocular.yaml') end if !filename or !File.exists?(filename) filename = File.('/etc/ocular.yaml') end return filename end |
.get(key) ⇒ Object
35 36 37 |
# File 'lib/ocular/settings.rb', line 35 def self.get(key) return @settings[key] end |
.load_from_file(filename) ⇒ Object
30 31 32 33 |
# File 'lib/ocular/settings.rb', line 30 def self.load_from_file(filename) ::Ocular.logger.debug "Loaded settings from #{filename}" @settings = ::Ocular::deep_symbolize(YAML::load_file(filename)) end |