lib/emittance.rb in emittance-0.0.3 vs lib/emittance.rb in emittance-0.0.4

- old
+ new

@@ -11,37 +11,53 @@ require 'emittance/registration' require 'emittance/event' require 'emittance/emitter' require 'emittance/watcher' require 'emittance/action' -require 'emittance/dispatcher' ## # The base namespace for this library. You can do some basic configuration stuff by calling methods on its singleton. # module Emittance class << self - # Enable eventing process-wide. + # Enable eventing process-wide def enable! Emittance::Brokerage.enable! end - # Disable eventing process-wide. + # Disable eventing process-wide def disable! Emittance::Brokerage.disable! end - # @return [Boolean] true if eventing is enabled, false otherwise. + # @return [Boolean] true if eventing is enabled, false otherwise def enabled? Emittance::Brokerage.enabled? end - # Not yet implemented! + # @return [Class] the currently enabled broker class + def broker + Emittance::Brokerage.broker + end + + # @return [Class] the dispatcher attached to the currently enabled broker + def dispatcher + broker.dispatcher + end + + # @param [identifier] the identifier that can be used to identify the broker you wish to use + def use_broker(identifier) + Emittance::Brokerage.use_broker identifier + end + + # Not yet implemented! Remove nocov and private flags when finished. # :nocov: # @private def suppress(&_blk) raise NotImplementedError, "This isn't working yet!" # Emittance::Dispatcher.suppress(&blk) end # :nocov: end end + +Emittance.use_broker :synchronous