Sha256: 3f9a6b30fabccf3b2575db07a5f6a38f2c3c3d1cd8b7dd30f3d6548527908821
Contents?: true
Size: 549 Bytes
Versions: 1
Compression:
Stored size: 549 Bytes
Contents
require 'micro/observers/version' module Micro module Observers require 'micro/observers/manager' module ClassMethods def call_observers(with: :call) proc do |object| Array(with) .each { |action| object.observers.call(action) } end end def notify_observers(with: :call) call_observers(with: with) end end def self.included(base) base.extend(ClassMethods) end def observers @observers ||= Observers::Manager.for(self) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
u-observers-0.3.0 | lib/micro/observers.rb |