Method: Module::Concerning#concern

Defined in:
activesupport/lib/active_support/core_ext/module/concerning.rb

#concern(topic, &module_definition) ⇒ Object

A low-cruft shortcut to define a concern.

concern :EventTracking do
  ...
end

is equivalent to

module EventTracking
  extend ActiveSupport::Concern

  ...
end


132
133
134
135
136
137
# File 'activesupport/lib/active_support/core_ext/module/concerning.rb', line 132

def concern(topic, &module_definition)
  const_set topic, Module.new {
    extend ::ActiveSupport::Concern
    module_eval(&module_definition)
  }
end