Sha256: b99a48c8c93335207f35393936bd6247a08ed1d428872a3d0d6cf62b1a85f1bc

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

require 'active_support/concern'
require 'active_support/core_ext/class/attribute'
require 'active_support/dependencies/autoload'

module ConcernedInheritance
  extend ActiveSupport::Autoload

  autoload :Delegator
  autoload :ClassMethods
  autoload :ModuleMethods

  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

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

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
concerned_inheritance-0.0.2 lib/concerned_inheritance.rb
concerned_inheritance-0.0.1 lib/concerned_inheritance.rb
memory_model-0.0.1 lib/concerned_inheritance.rb