Sha256: 126109a6adba83f002b6c34b1518905838b4952f25641f9f3d4e40ed2674d457

Contents?: true

Size: 570 Bytes

Versions: 54

Compression:

Stored size: 570 Bytes

Contents

module Rack::App::SingletonMethods::Inheritance

  def on_inheritance(&block)
    @on_inheritance ||= []
    @on_inheritance << block unless block.nil?
    @on_inheritance
  end

  protected

  def inherited(child)

    child.formats.merge!(formats)

    [:middlewares, :before, :after].each do |type|
      child.__send__(type).push(*__send__(type))
    end

    on_inheritance.each do |block|
      block.call(self, child)
      child.on_inheritance(&block)
    end

    error.handlers.each do |ex_class, block|
      child.error(ex_class, &block)
    end

  end

end

Version data entries

54 entries across 54 versions & 2 rubygems

Version Path
rack-app-11.0.2 lib/rack/app/singleton_methods/inheritance.rb
rack-app-11.0.1 lib/rack/app/singleton_methods/inheritance.rb
rack-app-11.0.0 lib/rack/app/singleton_methods/inheritance.rb
rack-app-10.0.0 lib/rack/app/singleton_methods/inheritance.rb
rack-app-9.0.0 lib/rack/app/singleton_methods/inheritance.rb
rack-app-8.1.0 lib/rack/app/singleton_methods/inheritance.rb
rack-app-8.0.1 lib/rack/app/singleton_methods/inheritance.rb
rack-app-8.0.0 lib/rack/app/singleton_methods/inheritance.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/rack-app-7.7.0/lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.7.0 lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.6.5 lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.6.4 lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.6.3 lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.6.2 lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.6.1 lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.6.0 lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.5.2 lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.5.1 lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.5.0 lib/rack/app/singleton_methods/inheritance.rb
rack-app-7.4.0 lib/rack/app/singleton_methods/inheritance.rb