Sha256: d296774e27b684d4133254fdf68395e98983386d5d0b31947b7743f089310233

Contents?: true

Size: 613 Bytes

Versions: 6

Compression:

Stored size: 613 Bytes

Contents

require 'active_support/core_ext/module/aliasing'

module Marshal
  class << self
    def load_with_autoloading(source)
      load_without_autoloading(source)
    rescue ArgumentError, NameError => exc
      if exc.message.match(%r|undefined class/module (.+?)(::)?\z|)
        # try loading the class/module
        loaded = $1.constantize

        raise unless $1 == loaded.name

        # if it is an IO we need to go back to read the object
        source.rewind if source.respond_to?(:rewind)
        retry
      else
        raise exc
      end
    end

    alias_method_chain :load, :autoloading
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activesupport-4.2.8/lib/active_support/core_ext/marshal.rb
activesupport-4.2.8 lib/active_support/core_ext/marshal.rb
activesupport-4.2.8.rc1 lib/active_support/core_ext/marshal.rb
activesupport-4.2.7.1 lib/active_support/core_ext/marshal.rb
activesupport-4.2.7 lib/active_support/core_ext/marshal.rb
activesupport-4.2.7.rc1 lib/active_support/core_ext/marshal.rb