문제

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

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

도움이 되었습니까?

해결책

Here's a "hello world" example derived from the specs. First the configuration file 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"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top