lib/abstract_preferences.rb
def defaults_accessor(name, default_value)
        key_path = "#{section_defaults_key}.#{name}"
        Preferences.default_values[key_path] = default_value
        
        class_eval do
          define_method(name) do
            Preferences.user_defaults[key_path].to_ruby
          end
          
          define_method("#{name}=") do |value|
            Preferences.user_defaults[key_path] = value
          end
          
          if default_value == true || default_value == false
            alias_method "#{name}?", name
          end
        end
        
        key_path
      end
# Defines a reader and writer method for a user defaults key for this section.
#
# If the preference is a boolean value, inflected from the default value,
# a query method is also defined.
#
#   # Defines #confirm_quit, #confirm_quit=, and #confirm_quit? It's default value is <tt>true</tt>.
#   defaults_accessor :confirm_quit, true
Defines a reader and writer method for a user defaults key for this section.
If the preference is a boolean value, inflected from the default value,
a query method is also defined.


Defines a reader and writer method for a user defaults key for this section . If the preference is a boolean value inflected from the default value a query method is also defined .
def defaults_accessor(name, default_value)
        key_path = "#{section_defaults_key}.#{name}"
        Preferences.default_values[key_path] = default_value
        class_eval do
          define_method(name) do
            Preferences.user_defaults[key_path].to_ruby
          end
          define_method("#{name}=") do |value|
            Preferences.user_defaults[key_path] = value
          end
          if default_value == true || default_value == false
            alias_method "#{name}?", name
          end
        end
        key_path
      end
def defaults_accessor ( name , default_value ) key_path = "#{section_defaults_key}.#{name}" Preferences . default_values [ key_path ] = default_value class_eval do define_method ( name ) do Preferences . user_defaults [ key_path ] . to_ruby end define_method ( "#{name}=" ) do | value | Preferences . user_defaults [ key_path ] = value end if default_value == true || default_value == false alias_method "#{name}?" , name end end key_path end
Defines a reader and writer method for a user defaults key for this section.
Defines a reader and writer method for a user defaults key for this section .
name
default_value