lib/mutex_m.rb in mutex_m-0.2.0 vs lib/mutex_m.rb in mutex_m-0.3.0

- old
+ new

@@ -15,11 +15,11 @@ # When 'mutex_m' is required, any object that extends or includes Mutex_m will # be treated like a Mutex. # # Start by requiring the standard library Mutex_m: # -# require "mutex_m.rb" +# require "mutex_m" # # From here you can extend an object with Mutex instance methods: # # obj = Object.new # obj.extend Mutex_m @@ -38,18 +38,23 @@ # obj = Foo.new # # this obj can be handled like Mutex # module Mutex_m - VERSION = "0.2.0" + VERSION = "0.3.0" Ractor.make_shareable(VERSION) if defined?(Ractor) def Mutex_m.define_aliases(cl) # :nodoc: cl.alias_method(:locked?, :mu_locked?) cl.alias_method(:lock, :mu_lock) cl.alias_method(:unlock, :mu_unlock) cl.alias_method(:try_lock, :mu_try_lock) cl.alias_method(:synchronize, :mu_synchronize) + end + + def Mutex_m.prepend_features(cl) # :nodoc: + super + define_aliases(cl) unless cl.instance_of?(Module) end def Mutex_m.append_features(cl) # :nodoc: super define_aliases(cl) unless cl.instance_of?(Module)