class Obuf::ProtectedLens
Similar to Obuf::Lens
but protects all the operations that change the IO offset with a Mutex.
Public Class Methods
new(io)
click to toggle source
Calls superclass method
Obuf::Lens::new
# File lib/obuf/protected_lens.rb, line 6 def initialize(io) super @mutex = Mutex.new end
Public Instance Methods
<<(object_to_store)
click to toggle source
Store an object
Calls superclass method
Obuf::Lens#<<
# File lib/obuf/protected_lens.rb, line 12 def <<(object_to_store) @mutex.synchronize { super } end
recover_at(idx)
click to toggle source
Calls superclass method
Obuf::Lens#recover_at
# File lib/obuf/protected_lens.rb, line 16 def recover_at(idx) @mutex.synchronize { super } end
recover_object()
click to toggle source
Calls superclass method
Obuf::Lens#recover_object
# File lib/obuf/protected_lens.rb, line 20 def recover_object @mutex.synchronize { super } end