module B1Config

Constants

VERSION

Public Instance Methods

add_load_path(path) click to toggle source

Add directory to config loaded path

# File lib/b1_config.rb, line 39
def add_load_path path
  path = "/" + path.to_s.split("/").reject(&:empty?).join("/") + "/"
  @@load_paths << path.to_s unless @@load_paths.include?(path.to_s)
  self
end
get_const() click to toggle source

Get registered constant

# File lib/b1_config.rb, line 34
def get_const
  B1Config.name.constantize
end
load_constant() click to toggle source

Load constant

# File lib/b1_config.rb, line 21
def load_constant
  Kernel.send(:remove_const, B1Config.name) if Kernel.const_defined?(B1Config.name)
  Kernel.const_set(B1Config.name, B1Config::Options)
  self
end
load_data() click to toggle source

Load data from .yml files in load directories

# File lib/b1_config.rb, line 28
def load_data
  B1Config::Loader.load(@@load_paths)
  self
end
Also aliased as: reload!
reload!()
Alias for: load_data
remove_load_path(path) click to toggle source

Remove directory from config loaded path

# File lib/b1_config.rb, line 46
def remove_load_path path
  @@load_paths.reject!{|pth| path==pth}
  self
end
setup() { |self| ... } click to toggle source

Setup moduleand set base params

# File lib/b1_config.rb, line 12
def setup &block
  @@env = Rails.env if defined?(::Rails)
  @@load_paths << "#{Rails.root.to_s}/config/configs/"  if defined?(::Rails)
  yield self
  B1Config.load_data
  load_constant
end