class SyncEm
SyncEm
is a simple decorator of an existing object that makes all its methods thread-safe.
For more information read README file.
- Author
-
Yegor Bugayenko (yegor256@gmail.com)
- Copyright
-
Copyright © 2018-2019 Yegor Bugayenko
- License
-
MIT
Public Class Methods
new(origin)
click to toggle source
# File lib/syncem.rb, line 37 def initialize(origin) @origin = origin @mutex = Mutex.new end
Public Instance Methods
method_missing(*args) { |*a| ... }
click to toggle source
Calls superclass method
# File lib/syncem.rb, line 42 def method_missing(*args) @mutex.synchronize do if @origin.respond_to?(args[0]) @origin.__send__(*args) do |*a| yield(*a) if block_given? end else super end end end
respond_to?(method, include_private = false)
click to toggle source
# File lib/syncem.rb, line 54 def respond_to?(method, include_private = false) @origin.respond_to?(method, include_private) end
respond_to_missing?(_method, _include_private = false)
click to toggle source
# File lib/syncem.rb, line 58 def respond_to_missing?(_method, _include_private = false) true end