Sha256: 24e0c90479f3405caa31ea6eccb1dcb3af31b2b78c8618a5b7c19843fc7fe539

Contents?: true

Size: 542 Bytes

Versions: 7

Compression:

Stored size: 542 Bytes

Contents

# frozen_string_literal: true

module Switchman
  module CallSuper
    def super_method_above(method_name, above_module)
      method = method(method_name)
      last_owner = method.owner
      while method.owner != above_module
        method = method.super_method
        raise "Could not find super method ``#{method_name}' for #{self.class}" if method.owner == last_owner
      end
      method.super_method
    end

    def call_super(method, above_module, ...)
      super_method_above(method, above_module).call(...)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
switchman-3.6.7 lib/switchman/call_super.rb
switchman-3.6.6 lib/switchman/call_super.rb
switchman-3.6.5 lib/switchman/call_super.rb
switchman-3.6.3 lib/switchman/call_super.rb
switchman-3.6.2 lib/switchman/call_super.rb
switchman-3.6.1 lib/switchman/call_super.rb
switchman-3.6.0 lib/switchman/call_super.rb