class Loom::Config
Constants
- CONFIG_VARS
TODO: Add a more module config_var registry mechanism for Modules and FactProviders to register their own values & defaults.
Public Class Methods
configure(config=nil) { |config_struct| ... }
click to toggle source
# File lib/loom/config.rb, line 65 def configure(config=nil, &block) # do NOT call Loom.log inside this block, the logger may not be # configured, triggering an infinite recursion map = config ? config.config_map : CONFIG_VARS.dup config_struct = OpenStruct.new **map yield config_struct if block_given? Config.new config_struct.to_h end
new(**config_map)
click to toggle source
# File lib/loom/config.rb, line 39 def initialize(**config_map) config_map.each do |k,v| # allows attr_reader methods from CONFIG_VAR to work instance_variable_set :"@#{k}", v end @config_map = config_map @file_manager = FileManager.new self end
Public Instance Methods
[](key)
click to toggle source
# File lib/loom/config.rb, line 49 def [](key) @config_map[key] end
files()
click to toggle source
TODO: disallow CONFIG_VAR properties named after Config
methods.… like files. this is shitty, but I don't want to do a larger change.
# File lib/loom/config.rb, line 60 def files @file_manager end
to_yaml()
click to toggle source
# File lib/loom/config.rb, line 53 def to_yaml @config_map.to_yaml end
Also aliased as: dump