class Inhelint::Lint
Public Class Methods
new(level: 2, handler: nil)
click to toggle source
Calls superclass method
# File lib/inhelint.rb, line 7 def initialize(level: 2, handler: nil) super() @level = level @handler = handler end
Public Instance Methods
included(base)
click to toggle source
# File lib/inhelint.rb, line 13 def included(base) level = @level handler = @handler || proc { raise Error, "Inheritance level too deep: #{level}" } inherited = proc do |klass| if klass.ancestors.count { |a| a.is_a?(Class) && a <= base } > level handler.call(klass) else klass.define_singleton_method(:inherited, inherited) end end inherited[base] end
Also aliased as: prepended