Sha256: 9c2028b5dc8599020481a12634732081a83f8a0d1bd356fac43d0de64f74e69f

Contents?: true

Size: 685 Bytes

Versions: 3

Compression:

Stored size: 685 Bytes

Contents

module Typhoeus
  class Request

    # This module contains custom serializer.
    module Marshal

      # Return the important data needed to serialize this Request, except the
      # `on_complete`, `on_success`, `on_failure`, and `hydra`, since they cannot be marshalled.
      def marshal_dump
        unmarshallable = %w(@on_complete @on_success @on_failure @hydra)
        (instance_variables - unmarshallable - unmarshallable.map(&:to_sym)).map do |name|
          [name, instance_variable_get(name)]
        end
      end

      # Load.
      def marshal_load(attributes)
        attributes.each { |name, value| instance_variable_set(name, value) }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
typhoeus-0.6.6 lib/typhoeus/request/marshal.rb
typhoeus-0.6.5 lib/typhoeus/request/marshal.rb
typhoeus-0.6.4 lib/typhoeus/request/marshal.rb