Sha256: c39c4e2ac9019ecea89f09a1b756148de1da011e7176b43f3178d25da78aa577

Contents?: true

Size: 640 Bytes

Versions: 16

Compression:

Stored size: 640 Bytes

Contents

module Marshal
  class << self
    # @private
    def dump_with_mocks(*args)
      object = args.shift
      spies = Spy::Subroutine.get_spies(object)
      if spies.empty?
        return dump_without_mocks(*args.unshift(object))
      end

      spy_hook_options = spies.map do |spy|
        [spy.hook_opts, spy.unhook]
      end

      begin
        dump_without_mocks(*args.unshift(object.dup))
      ensure
        spy_hook_options.each do |hook_opts, spy|
          spy.hook(hook_opts)
        end
      end
    end

    alias_method :dump_without_mocks, :dump
    undef_method :dump
    alias_method :dump, :dump_with_mocks
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
spy-1.0.5 lib/spy/core_ext/marshal.rb
spy-1.0.4 lib/spy/core_ext/marshal.rb
spy-1.0.3 lib/spy/core_ext/marshal.rb
spy-1.0.2 lib/spy/core_ext/marshal.rb
spy-1.0.1 lib/spy/core_ext/marshal.rb
spy-1.0.0 lib/spy/core_ext/marshal.rb
spy-0.4.5 lib/spy/core_ext/marshal.rb
spy-0.4.3 lib/spy/core_ext/marshal.rb
spy-0.4.2 lib/spy/core_ext/marshal.rb
spy-0.4.1 lib/spy/core_ext/marshal.rb
spy-0.4.0 lib/spy/core_ext/marshal.rb
spy-0.3.1 lib/spy/core_ext/marshal.rb
spy-0.3.0 lib/spy/core_ext/marshal.rb
spy-0.2.5 lib/spy/core_ext/marshal.rb
spy-0.2.4 lib/spy/core_ext/marshal.rb
spy-0.2.3 lib/spy/core_ext/marshal.rb