Sha256: 28dc388cb69664f0a207ec8744f5d0f9f40535bf230406209a89c3ad3cf4d0ac

Contents?: true

Size: 840 Bytes

Versions: 145

Compression:

Stored size: 840 Bytes

Contents

require 'rspec/mocks/extensions/marshal'
require 'rspec/mocks/extensions/psych' if defined?(::Psych)

module RSpec
  module Mocks
    # @private
    module Serialization
      # @private
      def self.fix_for(object)
        object.extend(YAML) if defined?(::YAML)
      rescue TypeError
        # Can't extend Fixnums, Symbols, true, false, or nil
      end

      # @private
      module YAML
        # @private
        def to_yaml(options = {})
          return nil if defined?(::Psych) && options.respond_to?(:[]) && options[:nodump]
          return super(options) unless instance_variable_defined?(:@mock_proxy)

          mp = @mock_proxy
          remove_instance_variable(:@mock_proxy)

          begin
            super(options)
          ensure
            @mock_proxy = mp
          end
        end
      end
    end
  end
end

Version data entries

145 entries across 94 versions & 18 rubygems

Version Path
vagrant-actionio-0.0.9 vendor/bundle/gems/rspec-mocks-2.13.0/lib/rspec/mocks/serialization.rb
rspec-mocks-2.13.0 lib/rspec/mocks/serialization.rb
remq-0.0.4 vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/serialization.rb
remq-0.0.3 vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/serialization.rb
rspec-mocks-2.12.2 lib/rspec/mocks/serialization.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
classiccms-0.6.9 vendor/bundle/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
classiccms-0.6.9 vendor/bundle/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
rspec-mocks-2.12.1 lib/rspec/mocks/serialization.rb
rspec-mocks-2.12.0 lib/rspec/mocks/serialization.rb
classiccms-0.6.8 vendor/bundle/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
classiccms-0.6.8 vendor/bundle/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
classiccms-0.6.7 vendor/bundle/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
classiccms-0.6.7 vendor/bundle/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/lib/rspec/mocks/serialization.rb
classiccms-0.6.6 vendor/bundle/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
classiccms-0.6.6 vendor/bundle/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
classiccms-0.6.5 vendor/bundle/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
classiccms-0.6.5 vendor/bundle/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
classiccms-0.6.4 vendor/bundle/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb