Module: ActiveSupport::Concern

Included in:
AbstractController::AssetPaths, AbstractController::Callbacks, AbstractController::Helpers, AbstractController::Layouts, AbstractController::Logger, AbstractController::Rendering, AbstractController::ViewPaths, ActionController::Caching, ActionController::Caching::Actions, ActionController::Caching::Pages, ActionController::Caching::Sweeping, ActionController::Compatibility, ActionController::ConditionalGet, ActionController::Cookies, ActionController::Flash, ActionController::Head, ActionController::Helpers, ActionController::HideActions, ActionController::Instrumentation, ActionController::MimeResponds, ActionController::RackDelegation, ActionController::Redirecting, ActionController::Renderers, ActionController::Renderers::All, ActionController::Rendering, ActionController::RequestForgeryProtection, ActionController::Rescue, ActionController::SessionManagement, ActionController::Streaming, ActionController::TemplateAssertions, ActionController::TestCase::Behavior, ActionController::Testing, ActionController::UrlFor, ActionDispatch::Assertions, ActionDispatch::Assertions::ResponseAssertions, ActionDispatch::Http::FilterParameters, ActionDispatch::Integration::Runner, ActionDispatch::Routing::UrlFor, ActionMailer::DeliveryMethods, ActionMailer::DeprecatedApi, ActionMailer::OldApi, ActionMailer::TestCase::Behavior, ActionMailer::TestHelper, ActionView::Helpers, ActionView::Helpers::FormHelper, ActionView::Helpers::FormTagHelper, ActionView::Helpers::InstanceTagMethods, ActionView::Helpers::SanitizeHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, ActionView::Helpers::UrlHelper, ActionView::Partials, ActionView::TestCase::Behavior, ActiveModel::AttributeMethods, ActiveModel::Dirty, ActiveModel::MassAssignmentSecurity, ActiveModel::Observing, ActiveModel::Serializers::JSON, ActiveModel::Serializers::Xml, ActiveModel::Validations, ActiveModel::Validations::Callbacks, ActiveRecord::Aggregations, ActiveRecord::AssociationPreload, ActiveRecord::Associations, ActiveRecord::AttributeMethods, ActiveRecord::AttributeMethods::BeforeTypeCast, ActiveRecord::AttributeMethods::Dirty, ActiveRecord::AttributeMethods::PrimaryKey, ActiveRecord::AttributeMethods::Query, ActiveRecord::AttributeMethods::Read, ActiveRecord::AttributeMethods::TimeZoneConversion, ActiveRecord::AttributeMethods::Write, ActiveRecord::AutosaveAssociation, ActiveRecord::Callbacks, ActiveRecord::Locking::Optimistic, ActiveRecord::NamedScope, ActiveRecord::NestedAttributes, ActiveRecord::QueryMethods, ActiveRecord::Railties::ControllerRuntime, ActiveRecord::Reflection, ActiveRecord::Serialization, ActiveRecord::TestFixtures, ActiveRecord::Timestamp, ActiveRecord::Transactions, ActiveRecord::Validations, ActiveResource::CustomMethods, ActiveResource::Observing, ActiveResource::Validations, Callbacks, Configurable, Rescuable, Testing::SetupAndTeardown
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