Sha256: f9444a9acba2b675e880fa02931a1c7ddeda396de99206dc99be4e90ce89e3c1
Contents?: true
Size: 590 Bytes
Versions: 17
Compression:
Stored size: 590 Bytes
Contents
unless Method.method_defined? :super_method require 'backports/1.8.7/array/find_index' class Method def super_method singleton_klass = class << receiver; self; end call_chain = singleton_klass.ancestors # find current position in call chain: skip = call_chain.find_index {|c| c == owner} or return call_chain = call_chain.drop(skip + 1) # find next in chain with a definition: next_index = call_chain.find_index {|c| c.method_defined? name} next_index && call_chain[next_index].instance_method(name).bind(receiver) end end end
Version data entries
17 entries across 17 versions & 1 rubygems