Sha256: 8bf5307f49bc16b59a835da1e1a7cf869c89c69d8935ccbe8c35e293c76186a7
Contents?: true
Size: 547 Bytes
Versions: 20
Compression:
Stored size: 547 Bytes
Contents
# Event lock. Locks current thread until matching event is emitted # @!attribute [r] plug # @return [Plug] Plug # @!attribute [r] pattern # @return [Hash<Symbol>] Pattern class ProtonBot::EventLock attr_reader :plug, :pattern # @param plug [Plug] # @param pattern [Hash<Symbol>] def initialize(plug, pattern) @plug = plug @plug.event_locks << self @pattern = pattern @unlock = false sleep(0.01) until @unlock end # Unlocks current thread # @return [NilClass] def unlock @unlock = true nil end end
Version data entries
20 entries across 20 versions & 1 rubygems