class Elasticonf::Config

Public Instance Methods

config_file() click to toggle source
# File lib/elasticonf/config.rb, line 37
def config_file
  @config_file ||= 'settings'
end
config_file=(value) click to toggle source
# File lib/elasticonf/config.rb, line 41
def config_file=(value)
  unless [String, Symbol].include?(value.class)
    raise ArgumentError, "String or Symbol expected #{value.class} given"
  end
  @config_file = value.to_s
end
config_root() click to toggle source
# File lib/elasticonf/config.rb, line 26
def config_root
  @config_root ||= raise(ArgumentError, 'You must specify config_root option first')
end
config_root=(value) click to toggle source
# File lib/elasticonf/config.rb, line 30
def config_root=(value)
  unless [String, Symbol, Pathname].include?(value.class)
    raise ArgumentError, "String or Symbol or Pathname expected #{value.class} given"
  end
  @config_root = value.is_a?(Pathname) ? value : Pathname.new(value.to_s)
end
const_name() click to toggle source
# File lib/elasticonf/config.rb, line 48
def const_name
  @const_name ||= 'Settings'
end
const_name=(value) click to toggle source
# File lib/elasticonf/config.rb, line 52
def const_name=(value)
  unless [String, Symbol].include?(value.class)
    raise ArgumentError, "String or Symbol expected #{value.class} given"
  end
  @const_name = value.to_s
end
env() click to toggle source
# File lib/elasticonf/config.rb, line 15
def env
  @env ||= 'development'
end
env=(value) click to toggle source
# File lib/elasticonf/config.rb, line 19
def env=(value)
  unless [String, Symbol].include?(value.class)
    raise ArgumentError, "String or Symbol expected #{value.class} given"
  end
  @env = value.to_s
end
raise_if_already_initialized_constant() click to toggle source
# File lib/elasticonf/config.rb, line 59
def raise_if_already_initialized_constant
  @raise_if_already_initialized_constant.nil? ? true : @raise_if_already_initialized_constant
end
raise_if_already_initialized_constant=(value) click to toggle source
# File lib/elasticonf/config.rb, line 63
def raise_if_already_initialized_constant=(value)
  unless [TrueClass, FalseClass].include?(value.class)
    raise ArgumentError, "TrueClass or FalseClass expected #{value.class} given"
  end
  @raise_if_already_initialized_constant = value
end
reset_config!() click to toggle source
# File lib/elasticonf/config.rb, line 3
def reset_config!
  %w(
    env
    config_root
    config_file
    const_name
    raise_if_already_initialized_constant
  ).each do |v|
    instance_variable_set "@#{v}", nil
  end
end