Settingslogic, a great settings solution or the greatest?

If there is one thing we can all agree on, say it with me…ruby doesn’t have enough settings solutions. You finished the sentence without even reading it didn’t you?

Actually considering there are a million settings solutions, this is probably the last thing we need. That being said, I decided to add my own personal settings solution to the mix called Settingslogic. It’s nothing crazy or new. Just a simple solution to a simple problem. Settingslogic provides globally accessible settings via an ERB enabled YAML file. It has been great for my apps, maybe you will enjoy it too. Here’s how it works…

Create your settings

This is a typical YAML file, notice ERB is allowed.

# app/config/application.yml
defaults: &defaults
    saweet: nested settings
  neat_setting: 24
  awesome_setting: <%= "Did you know 5 + 5 = " + (5 + 5) + "?" %>

  <<: *defaults
  neat_setting: 800

  <<: *defaults

  <<: *defaults

Access your settings

  => "development"

  => "#<Settingslogic::Settings ... >"

  => "nested settings"

  >> Settings.neat_setting
  => 800

  >> Settings.awesome_setting
  => "Did you know 5 + 5 = 10?"

Give me more

You got it!

  • Share/Save/Bookmark

One Response to “Settingslogic, a great settings solution or the greatest?”

  1. Reader says:

    Wow! Thank you!
    I always wanted to write in my site something like that. Can I take part of your post to my blog?
    Of course, I will add backlink?

    Regards, Your Reader