Module: ConcernedInheritance

Extended by:
ActiveSupport::Autoload
Defined in:
lib/concerned_inheritance.rb,
lib/concerned_inheritance/version.rb

Defined Under Namespace

Modules: ClassMethods, ModuleMethods Classes: Delegator

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/concerned_inheritance.rb', line 12

def self.extended(base)
  case base
  when Class
    base.extend ClassMethods
  when Module
    base.extend ModuleMethods
  end
  base.instance_variable_set :@inherited_callbacks, [] unless base.instance_variable_defined? :@inherited_callbacks
end

Instance Method Details

#define_inherited_callback(&block) ⇒ Object

Raises:

  • (ArgumentError)


22
23
24
25
# File 'lib/concerned_inheritance.rb', line 22

def define_inherited_callback(&block)
  raise ArgumentError, 'missing required block' unless block_given?
  @inherited_callbacks += [block]
end