Module: Funl::Blobber
- Defined in:
- lib/funl/blobber.rb
Constant Summary collapse
- MARSHAL_TYPE =
ObjectStream::MARSHAL_TYPE
- YAML_TYPE =
ObjectStream::YAML_TYPE
- JSON_TYPE =
ObjectStream::JSON_TYPE
- MSGPACK_TYPE =
ObjectStream::MSGPACK_TYPE
Class Method Summary collapse
-
.for(type) ⇒ Object
Returns something which responds to #dump(obj) and #load(str).
Class Method Details
.for(type) ⇒ Object
Returns something which responds to #dump(obj) and #load(str).
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/funl/blobber.rb', line 11 def self.for type case type when MARSHAL_TYPE Marshal when YAML_TYPE require 'yaml' YAML when JSON_TYPE require 'yajl' require 'yajl/json_gem' ## would 'json' conflict with yajl required from other libs? JSON when MSGPACK_TYPE require 'msgpack' MessagePack else raise ArgumentError, "unknown type: #{type.inspect}" end end |