Class: RSpec::Mocks::MarshalExtension Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rspec-mocks/lib/rspec/mocks/marshal_extension.rb |
Overview
::RSpec::Support
for patch_marshal_to_support_partial_doubles
configuration.
Class Method Summary
Class Method Details
.patch!
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/marshal_extension.rb', line 7
def self.patch! return if Marshal.respond_to?(:dump_with_rspec_mocks) Marshal.instance_eval do class << self def dump_with_rspec_mocks(object, *rest) if !::RSpec::Mocks.space.registered?(object) || NilClass === object dump_without_rspec_mocks(object, *rest) else dump_without_rspec_mocks(object.dup, *rest) end end alias_method :dump_without_rspec_mocks, :dump undef_method :dump alias_method :dump, :dump_with_rspec_mocks end end end
.unpatch!
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/marshal_extension.rb', line 27
def self.unpatch! return unless Marshal.respond_to?(:dump_with_rspec_mocks) Marshal.instance_eval do class << self undef_method :dump_with_rspec_mocks undef_method :dump alias_method :dump, :dump_without_rspec_mocks undef_method :dump_without_rspec_mocks end end end