module Finalist::ModuleMethods

Public Instance Methods

extend(mod) click to toggle source
Calls superclass method
# File lib/finalist.rb, line 100
def extend(mod)
  super

  singleton_class.ancestors.drop(1).each do |mod|
    Finalist.finalized_methods[mod]&.each do |final_method_name|
      meth =
        begin
          singleton_class.instance_method(final_method_name)
        rescue NoMethodError
          nil
        end

      verify_final_method(meth, :extend) if meth
    end
  end
end
include(mod) click to toggle source
Calls superclass method
# File lib/finalist.rb, line 83
def include(mod)
  super

  ancestors.drop(1).each do |mod|
    Finalist.finalized_methods[mod]&.each do |final_method_name|
      meth =
        begin
          instance_method(final_method_name)
        rescue NoMethodError
          nil
        end

      verify_final_method(meth, :include) if meth
    end
  end
end

Private Instance Methods

extended(base) click to toggle source
# File lib/finalist.rb, line 140
def extended(base)
  def base.singleton_method_added(symbol)
    super

    return if Finalist.disabled?

    meth =
      begin
        singleton_class.instance_method(symbol)
      rescue NoMethodError
        nil
      end

    verify_final_method(meth, :extended_singleton_method_added) if meth
  end

  base.singleton_class.ancestors.drop(1).each do |mod|
    Finalist.finalized_methods[mod]&.each do |final_method_name|
      meth =
        begin
          base.singleton_class.instance_method(final_method_name)
        rescue NoMethodError
          nil
        end

      verify_final_method(meth, :extended) if meth
    end
  end
end
included(base) click to toggle source
Calls superclass method
# File lib/finalist.rb, line 119
def included(base)
  super

  return if Finalist.disabled?

  base.extend(Finalist)

  base.ancestors.drop(1).each do |mod|
    Finalist.finalized_methods[mod]&.each do |final_method_name|
      meth =
        begin
          meth = base.instance_method(final_method_name)
        rescue NoMethodError
          nil
        end

      verify_final_method(meth, :included) if meth
    end
  end
end