Module: ActiveSupport::Concern

Defined in:
activesupport/lib/active_support/concern.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) extended(base)



38
39
40
# File 'activesupport/lib/active_support/concern.rb', line 38

def self.extended(base)
  base.instance_variable_set("@_dependencies", [])
end

Instance Method Details

- (Object) append_features(base)



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'activesupport/lib/active_support/concern.rb', line 42

def append_features(base)
  if base.instance_variable_defined?("@_dependencies")
    base.instance_variable_get("@_dependencies") << self
    return false
  else
    return false if base < self
    @_dependencies.each { |dep| base.send(:include, dep) }
    super
    base.extend const_get("ClassMethods") if const_defined?("ClassMethods")
    base.send :include, const_get("InstanceMethods") if const_defined?("InstanceMethods")
    base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block")
  end
end

- (Object) included(base = nil, &block)



56
57
58
59
60
61
62
# File 'activesupport/lib/active_support/concern.rb', line 56

def included(base = nil, &block)
  if base.nil?
    @_included_block = block
  else
    super
  end
end