Sha256: 01fb9960dfb7cbe9b10c73ddf68caa55e941406e81af134f03177aef9368389f
Contents?: true
Size: 420 Bytes
Versions: 8
Compression:
Stored size: 420 Bytes
Contents
module Specs def self.stub_out_class_method(mod, meth) meta = (class << mod; self; end) original_meth = "original_#{meth}".to_sym fail "ALREADY TRACED: #{mod}.#{meth}" if mod.respond_to?(original_meth) meta.send(:alias_method, original_meth, meth) meta.send(:define_method, meth) do |*args, &block| yield(*args) if block_given? mod.send original_meth, *args, &block end end end
Version data entries
8 entries across 8 versions & 1 rubygems