preferences 0.3
- Added the register API, which combines and simplifies register_pref_key and
register_pref_var calls. Instead of
PREFS.register_pref_key self, "my app/window"
PREFS.register_pref_var self, :x, :y => "default_y"
PREFS.register_pref_var self, "z"
you simply do
PREFS.register "my app/window" do |entry|
entry.var :x, :y => "default_y"
entry.var "z"
end
- Changed examples/simple.rb, examples/foursplit-prefs.rb, and intro.txt to
use this new API.
- Added life-cycle.rb example.
- Updated foursplit-prefs.rb to work with fox14.
- Added some error checking, in case of a prefs file that is valid YAML but
not usable for preferences (e.g., "— foo"). This now raises
Preferences::LoadError.
preferences 0.2
- Improved behavior with objects that have a short lifespan (i.e. objects
which may be gone by the time their preferences are saved):
- The in-memory database of preferences no longer references the app objects,
but uses weak references instead, so the app objects are not prevented from
being garbage collected.
- New methods exist to safely connect and disconnect objects from the
preferences database, so that invalid objects are not queried for their
data. See examples/life-cycle.rb.
- DataUnavailable exception class can be raised by client code (in a reader
method, for example) to avoid saving a bogus variable value.
- Default values for variables can take a Proc, which is called only if
needed to produce the default value.
- Added Preferences#clear
to clear preferences in current process, and thereby revert to defaults
next time program is run.
preferences 0.1