module RubyConf

Public Class Methods

[](name) click to toggle source
# File lib/ruby-conf.rb, line 290
def [](name) @@__rc_configs[name.to_sym] end
clear() click to toggle source
# File lib/ruby-conf.rb, line 281
def clear()
  Loader::__rc_set_conf
  @@__rc_configs.clear
end
define(name = nil, options = {}, &block) click to toggle source
# File lib/ruby-conf.rb, line 294
def define(name = nil, options = {}, &block)
  config = Config.new(name, &block)
  @@__rc_configs[name.to_sym] = config unless name.nil?

  const = options.fetch(:as, name)
  if const && const.to_s[/^[A-Z]/]
    const = const.to_sym
    ::Object.const_set(const, config) if !::Object.const_defined?(const) || ::Object.const_get(const).is_a?(Config)
  end

  if Loader::__rc_conf.nil? && (name.nil? || name.to_s =~ /^(?:Rails)?Conf/)
    default_conf = if ::Object.const_defined?(:Rails)
      cfg = config[:"#{::Rails.env}"] || config[:"#{::Rails.env}_conf"] || config[:"#{::Rails.env}_config"]
      (cfg && cfg.detach) || config
    else
      config
    end
    Loader::__rc_set_conf(default_conf)
  end

  config
end
err(*objs) click to toggle source
# File lib/ruby-conf.rb, line 11
def self.err(*objs) self.puts($stderr, *objs) end
inspect() click to toggle source
# File lib/ruby-conf.rb, line 288
def inspect() @@__rc_configs.inspect end
method_missing(name, *args) click to toggle source
# File lib/ruby-conf.rb, line 291
def method_missing(name, *args) @@__rc_configs[name.to_sym] end
out(*objs) click to toggle source
# File lib/ruby-conf.rb, line 12
def self.out(*objs) self.puts($stdout, *objs) end
puts(logger = $stdout, *obj) click to toggle source
# File lib/ruby-conf.rb, line 10
def self.puts(logger = $stdout, *obj) logger.puts(*obj) if logger.respond_to?(:puts) end
respond_to?(name) click to toggle source
# File lib/ruby-conf.rb, line 292
def respond_to?(name) @@__rc_configs.key?(name.to_sym) end
to_s() click to toggle source
# File lib/ruby-conf.rb, line 286
def to_s() @@__rc_configs.to_s end
to_str() click to toggle source
# File lib/ruby-conf.rb, line 287
def to_str() @@__rc_configs.to_str end