class Carioca::Services::Configuration
Service Configuration
of Carioca
Attributes
settings[RW]
@example
config = Carioca::Services::Configuration::new :config_file => 'afilename', :context => 'production' p config.config_file config_file = 'newfilename'
@attr_reader [String] the filename of the YAML struct
Public Class Methods
new(_opts = {})
click to toggle source
Configuration
service constructor (open config) @param [Hash] _options the params @option _options [String] :config_file the filename of the config
# File lib/carioca/services/configuration.rb, line 140 def initialize(_opts = {}) options = Methodic.get_options(_opts) options.specify_default_value :config_file => "./.config" options.merge @settings = Carioca::Services::Settings.new(options) end
Public Instance Methods
config_file()
click to toggle source
reading wrapper to @settings.config_file accessor @return [String] @config_file the file name @example usage
config = Carioca::Services::Configuration::new :config_file => 'afilename', :context => 'production' p config.config_file
# File lib/carioca/services/configuration.rb, line 166 def config_file @settings.config_file end
config_file=(name)
click to toggle source
writting wrapper to @settings.config_file accessor @param [String] name the file name @example usage
config = Carioca::Services::Configuration::new :config_file => 'afilename', :context => 'production' config.config_file = 'newfile'
# File lib/carioca/services/configuration.rb, line 175 def config_file=(name) @settings.config_file = name end
garbage()
click to toggle source
garbage service hook @note close the logger @note call by Carioca::Services::Registry#close
# File lib/carioca/services/configuration.rb, line 183 def garbage @settings = nil return true end
save!()
click to toggle source
Proxy to @settings.save!
save the Hash(self) in the file named by @config_file
@return [TrueClass,FalseClass] true if save! successfull @example usage
config = Carioca::Services::Configuration::new :config_file => 'afilename', :context => 'production' config.config_file = 'newfile' config.save!
# File lib/carioca/services/configuration.rb, line 156 def save! @settings.save! end