Confi
A simple and efficient "configuration" gem for Ruby (can be used in Rails as well). Options can be initialized as required and later be accessed.
A global Confi (the usual usage) as well as an instance (not recommended) configuration are supported.
See Usage below.
Usage (global Confi)
require "confi"
...
Confi.debug = true
...
if Confi.debug
...
end
...
Configure (initialization)
Confi.configure(hash)
Confi.configure do |s|
s.option = :active
s.name = "name"
end
Usage (in instances)
require "confi"
class User # a sample
include Confi
end
...
# create instance
user = User.new
# Functionality same as with Confi; use instance name
user.debug = false
...
...
# Not yet initialized attribute
if Confi.debug # NoMethodError: undefined method 'debug'
...
end
...
Installation
As usual:
# Gemfile
...
gem "confi"
...
and run "bundle install".
Miscellaneous
Copyright (c) 2025 Dittmar Krall (www.matiq.com), released under the MIT license.