Class: MIME::Types::Container
- Inherits:
-
Hash
- Object
- Hash
- MIME::Types::Container
- Defined in:
- lib/mime/types/cache.rb
Overview
MIME::Types requires a container Hash with a default values for keys resulting in an empty array ([]
), but this cannot be dumped through Marshal because of the presence of that default Proc. This class exists solely to satisfy that need.
Instance Method Summary collapse
-
#initialize ⇒ Container
constructor
:nodoc:.
- #marshal_dump ⇒ Object
- #marshal_load(hash) ⇒ Object
Constructor Details
#initialize ⇒ Container
:nodoc:
60 61 62 63 |
# File 'lib/mime/types/cache.rb', line 60 def initialize super self.default_proc = ->(h, k) { h[k] = [] } end |
Instance Method Details
#marshal_dump ⇒ Object
65 66 67 |
# File 'lib/mime/types/cache.rb', line 65 def marshal_dump {}.merge(self) end |
#marshal_load(hash) ⇒ Object
69 70 71 |
# File 'lib/mime/types/cache.rb', line 69 def marshal_load(hash) self.merge!(hash) end |