Project

env-config

0.0
No commit activity in last 3 years
No release in over 3 years
Basic ruby environment-dependent configuration
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

EnvConfig

Basic ruby environment-dependent configuration

usage example:

# environment.rb
EnvConfig.configure(:default) do |config|
  config[:verbose] = true
end

# test.rb
EnvConfig.configure(:test) do |config|
  config[:verbose] = false
end

# development.rb
EnvConfig.configure(:development) do |config|
end


config = EnvConfig.new(:test)
config[:verbose] # => false

config = EnvConfig.new(:development)
config[:verbose] # => true

Exceptions

config[:unknown_key_12345] # => EnvConfig::ArgumentError

config = EnvConfig.new(:unknown_env_123) # => EnvConfig::UnknownEnvironmentError

config = EnvConfig.new(:default) # => EnvConfig::AbstractError

EnvConfig.configure(:test) do ...
EnvConfig.configure(:default) do ... # => EnvConfig::LoadOrderError

config[:verbose] = false # => EnvConfig::ImmutableError