module Stitcher::Core

Public Instance Methods

stitcher_add(name, sig, method) click to toggle source
# File lib/stitcher/core.rb, line 21
def stitcher_add name, sig, method
        sig = (method.arity < 0 ? +([Object] * method.arity.abs) : [Object] * method.arity.abs) unless sig
        stitcher_method_table(name)[sig] = method
end
stitcher_method_detecting(name, *args, &block) click to toggle source
# File lib/stitcher/core.rb, line 26
def stitcher_method_detecting name, *args, &block
        mtable = stitcher_method_table(name).to_a.reverse
        _, method = mtable.find {|sig, _| sig.=== args, &block }
        method
end
stitcher_method_table(name) click to toggle source
# File lib/stitcher/core.rb, line 11
def stitcher_method_table name
        instance_eval { @stitcher_method_table ||= {}; @stitcher_method_table[name] ||= {} }
end
stitcher_method_table_all(name) click to toggle source
# File lib/stitcher/core.rb, line 15
def stitcher_method_table_all name
        mtable = stitcher_method_table(name) unless superclass
        return stitcher_method_table_all(superclass, name).merge(mtable) if superclass
        mtable
end