class CrossPost::Config
Constants
- DEFAULT_CONFIG_FILE
- DEFAULT_CONFIG_FOLDER
Public Class Methods
new()
click to toggle source
# File lib/cross-post/config.rb, line 96 def initialize @configs = {} @dir = ENV.fetch 'CONFIG_FOLDER', DEFAULT_CONFIG_FOLDER file = ENV.fetch 'CONFIG_FILE', DEFAULT_CONFIG_FILE self.load :settings, file self.load :users self[:posts] = FifoSubConfig.new end
Public Instance Methods
[](name)
click to toggle source
# File lib/cross-post/config.rb, line 105 def [](name) @configs[name] end
[]=(name, value)
click to toggle source
# File lib/cross-post/config.rb, line 109 def []=(name, value) @configs[name] = value end
load(name, file = nil)
click to toggle source
# File lib/cross-post/config.rb, line 113 def load(name, file = nil) file ||= "#{name}.yml" file = File.join @dir, file File.write(file, YAML.dump({})) unless File.exist? file self[name] = FileSubConfig.new file end