Every repository with this icon (
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
LICENSE | Fri Nov 07 13:30:45 -0800 2008 | |
| |
README.rdoc | Fri Nov 07 14:48:24 -0800 2008 | |
| |
lib/ | Sun Nov 09 08:16:31 -0800 2008 | |
| |
test/ | Sun Nov 09 08:16:31 -0800 2008 |
RubyCocoa prefs
A ruby abstraction for read/write access to the NSUserDefaults of a Cocoa application. Originally written for a rewrite of the LimeChat preferences code.
LimeChat, the best irc client out there: github.com/psychs/limechat/tree/master My rewrite of the preferences: github.com/alloy/limechat/tree/refactor_preferences
There is also a helper class which assists in making an array of strings accessible via bindings.
Example
See the LimeChat source for a real life example.
class Preferences
class Keyword < Namespace
defaults_accessor :highlight_enabled, false
end
# Register the default values with NSUserDefaults.standardUserDefaults.
register_default_values!
end
# Elsewhere
preferences.keyword.highlight_enabled # => false
preferences.keyword.highlight_enabled? # => false
# Setting a new value will save the preference with NSUserDefaults.standardUserDefaults,
# which means the setting is in effect in memory and will be synchronized to disk every few minutes,
# or by calling preferences.save.
preferences.keyword.highlight_enabled = true
preferences.keyword.highlight_enabled # => true
preferences.keyword.highlight_enabled? # => true
MIT-LICENSE
Copyright © <2008> Eloy Duran <e.duran@superalloy.nl>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.







