lib/emittance.rb in emittance-0.0.1 vs lib/emittance.rb in emittance-0.0.2
- old
+ new
@@ -1,26 +1,41 @@
+# frozen_string_literal: true
+
require 'emittance/version'
+require 'emittance/errors'
+
+require 'emittance/brokerage'
+require 'emittance/broker'
require 'emittance/registration'
require 'emittance/event'
require 'emittance/event/event_builder'
require 'emittance/emitter'
require 'emittance/watcher'
require 'emittance/action'
-require 'emittance/broker'
+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
- @enabled = true
+ # Enable eventing process-wide.
+ def enable!
+ Emittance::Dispatcher.enable!
+ end
- def enabled?
- !!@enabled
+ # Disable eventing process-wide.
+ def disable!
+ Emittance::Dispatcher.disable!
end
- def enable
- @enabled = true
+ # @return [Boolean] true if eventing is enabled, false otherwise.
+ def enabled?
+ Emittance::Dispatcher.enabled?
end
- def disable
- @enabled = false
+ # @private
+ def suppress(&blk)
+ Emittance::Dispatcher.suppress(&blk)
end
end
end