README.rdoc in iron-settings-1.0.3 vs README.rdoc in iron-settings-1.0.4
- old
+ new
@@ -70,10 +70,14 @@
# You'd first define your schema at class level, passing the file
# you want to use as an option on creation
class_settings(:file => '~/.mytool') do
string('api_key')
string('base_path', '~')
+ group('options') do
+ bool('debug', false)
+ bool('verbose', false)
+ end
end
def initialize
# The bound file will be loaded automatically if present on first access.
# Verify we have what we need - interrogative version of keys test for the
@@ -83,14 +87,19 @@
end
end
end
-Now, your users could create a .mytool file like so:
+Now, your users could create a .mytool file like so. Notice how there are no equals signs,
+and the group settings can be accessed in a block:
api_key '1234ASDF'
base_path '~/code'
+ options do
+ debug true
+ verbose true
+ end
On calling MyTool.settings, this file would be loaded and override the settings defaults.
You could set up a similar arrangement for managing settings for Gems and other reusable libraries.
@@ -125,10 +134,10 @@
gem install iron-settings
Then use
- require 'iron/settings'
+ require 'iron-settings'
to require the library code.
If you want to use db-backed settings (for example, for per-model settings), you will need to run
the settings-creation migration. In a Rails project, simply run the provided rake settings:install task,
\ No newline at end of file