lib/abstract_preferences.rb
def defaults_kvc_accessor(name, path_to_eval_to_object)
      kvc_accessor(name)
      
      class_eval %{
        def #{name}
          @#{name} ||= #{path_to_eval_to_object}
        end
        
        def #{name}=(new_defaults)
          #{path_to_eval_to_object} = @#{name} = new_defaults
        end
      }, __FILE__, __LINE__
    end
# Defines a kvc_accessor which reads and writes
# to the specified preferences path (<tt>path_to_eval_to_object</tt>).
#
# This is useful for binding, for instance, UI elements
# to an array in the NSUserDefaults which is normally immutable.
#
#   class PreferencesController < OSX::NSWindowController
#     defaults_kvc_accessor :an_array_of_dictionaries, 'preferences.keyword.url_mappings'
#   end
#
# Binding a NSArrayController to File's Owner with key path: <tt>an_array_of_dictionaries</tt>,
# will perform the following read/write actions on the NSUserDefaults:
#
#   preferences_controller.valueForKey('an_array_of_dictionaries') # => [{'key' => 'value 1'}, {'key' => 'value 2'}]
#   preferences_controller.setValueForKey([{'key' => 'value 1'}], 'an_array_of_dictionaries')
#   preferences_controller.valueForKey('an_array_of_dictionaries') # => [{'key' => 'value 1'}]
Defines a kvc_accessor which reads and writes
to the specified preferences path (path_to_eval_to_object).

This is useful for binding, for instance, UI elements
to an array in the NSUserDefaults which is normally immutable.



Binding a NSArrayController to File's Owner with key path: an_array_of_dictionaries,
will perform the following read/write actions on the NSUserDefaults.


Defines a kvc_accessor which reads and writes to the specified preferences path ( path_to_eval_to_object ) . This is useful for binding for instance UI elements to an array in the NSUserDefaults which is normally immutable . Binding a NSArrayController to File ' s Owner with key path : an_array_of_dictionaries will perform the following read / write actions on the NSUserDefaults .
def defaults_kvc_accessor(name, path_to_eval_to_object)
      kvc_accessor(name)
      class_eval %{
        def #{name}
          @#{name} ||= #{path_to_eval_to_object}
        end
        def #{name}=(new_defaults)
          #{path_to_eval_to_object} = @#{name} = new_defaults
        end
      }, __FILE__, __LINE__
    end
def defaults_kvc_accessor ( name , path_to_eval_to_object ) kvc_accessor ( name ) class_eval %{
        def #{name}
          @#{name} ||= #{path_to_eval_to_object}
        end
        
        def #{name}=(new_defaults)
          #{path_to_eval_to_object} = @#{name} = new_defaults
        end
      } , __FILE__ , __LINE__ end
Defines a kvc_accessor which reads and writes
to the specified preferences path (<tt>path_to_eval_to_object</tt>).
Defines a kvc_accessor which reads and writes to the specified preferences path ( <tt > path_to_eval_to_object< / tt > ) .
name
path_to_eval_to_object