Method: ObjectStream.stream_class_for

Defined in:
lib/object-stream.rb

.stream_class_for(type) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/object-stream.rb', line 49

def stream_class_for type
  cl = @stream_class_map[type]
  return cl if cl.respond_to? :new

  # Protect against race condition in msgpack and yajl extension
  # initialization (bug #8374).
  @mutex.synchronize do
    return cl if cl.respond_to? :new
    @stream_class_map[type] = cl.call
  end
end