How do I use the SettingsLogic gem in a ruby ​​project?

According to the GitHub page , it is possible to use SettingsLogic in a Ruby project (outside of Rails), but there is no documentation to show you how.

Can anyone provide me with some sample code how it can work with things like Rails.env missing?

+3


source to share


1 answer


Here is an example "hello world" derived from the specs . First the configuration file is settings.yml

foo: 'hello world'

      



And the code:

require 'settingslogic'

class Settings < Settingslogic
  source "#{File.dirname(__FILE__)}/settings.yml"
end

p Settings.foo    # => "hello world"

      

+3


source







All Articles