Class Index [+]

Quicksearch

ActiveSupport::Configurable::ClassMethods

Public Instance Methods

config() click to toggle source
    # File lib/active_support/configurable.rb, line 29
29:       def config
30:         @_config ||= if respond_to?(:superclass) && superclass.respond_to?(:config)
31:           superclass.config.inheritable_copy
32:         else
33:           # create a new "anonymous" class that will host the compiled reader methods
34:           Class.new(Configuration).new
35:         end
36:       end
config_accessor(*names) click to toggle source

Allows you to add shortcut so that you don’t have to refer to attribute through config. Also look at the example for config to contrast.

  class User
    include ActiveSupport::Configurable
    config_accessor :allowed_access
  end

  user = User.new
  user.allowed_access = true
  user.allowed_access # => true
    # File lib/active_support/configurable.rb, line 54
54:       def config_accessor(*names)
55:         options = names.extract_options!
56: 
57:         names.each do |name|
58:           reader, line = "def #{name}; config.#{name}; end", __LINE__
59:           writer, line = "def #{name}=(value); config.#{name} = value; end", __LINE__
60: 
61:           singleton_class.class_eval reader, __FILE__, line
62:           singleton_class.class_eval writer, __FILE__, line
63:           class_eval reader, __FILE__, line unless options[:instance_reader] == false
64:           class_eval writer, __FILE__, line unless options[:instance_writer] == false
65:         end
66:       end
configure() click to toggle source
    # File lib/active_support/configurable.rb, line 38
38:       def configure
39:         yield config
40:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.