Sha256: 03c0c9fda9f4b3fdd7186d9bd557ecc3a3352b12c31c0532020df47fe69286f5
Contents?: true
Size: 759 Bytes
Versions: 7
Compression:
Stored size: 759 Bytes
Contents
# coding: utf-8 require 'monitor' require 'forwardable' module Hallon # Adds synchronization primitives to target when included. module Synchronizable # Creates a `Monitor` for the target instance and adds `monitor` class method for access. # # Also adds several other methods: # # - `#synchronize` # - `#new_cond` # # These all delegate to `#monitor`. # # @note This module is part of Hallons private API # @private def self.included(o) o.instance_exec do @monitor = Monitor.new class << self attr_reader :monitor end end end extend Forwardable def_delegators :monitor, :synchronize, :new_cond def_delegators 'self.class', :monitor end end
Version data entries
7 entries across 7 versions & 1 rubygems