Module: Mediate
- Defined in:
- lib/mediate.rb,
lib/mediate/request.rb,
lib/mediate/version.rb,
lib/mediate/mediator.rb,
lib/mediate/notification.rb,
lib/mediate/error_handler.rb,
lib/mediate/request_handler.rb,
lib/mediate/error_handler_state.rb,
lib/mediate/prerequest_behavior.rb,
lib/mediate/notification_handler.rb,
lib/mediate/postrequest_behavior.rb,
lib/mediate/errors/no_handler_error.rb,
lib/mediate/errors/request_handler_already_exists_error.rb
Overview
Namespace containing a simple implementation of the mediator pattern.
Defined Under Namespace
Modules: Errors Classes: ErrorHandler, ErrorHandlerState, Mediator, Notification, NotificationHandler, PostrequestBehavior, PrerequestBehavior, Request, RequestHandler
Constant Summary collapse
- VERSION =
"0.1.3"
Class Method Summary collapse
-
.dispatch(request) ⇒ Object
Sends a request to the registered handler, passing to any applicable pipeline behaviors.
-
.mediator ⇒ Mediate::Mediator
Get the current mediator instance.
-
.publish(notification) ⇒ void
Sends a notification to all registered handlers for the given notification’s type.
Class Method Details
.dispatch(request) ⇒ Object
Sends a request to the registered handler, passing to any applicable pipeline behaviors.
31 32 33 |
# File 'lib/mediate.rb', line 31 def self.dispatch(request) mediator.dispatch(request) end |
.mediator ⇒ Mediate::Mediator
Get the current mediator instance. This will be a singleton throughout the lifetime of the program.
17 18 19 |
# File 'lib/mediate.rb', line 17 def self.mediator Mediator.instance end |
.publish(notification) ⇒ void
This method returns an undefined value.
Sends a notification to all registered handlers for the given notification’s type.
42 43 44 |
# File 'lib/mediate.rb', line 42 def self.publish(notification) mediator.publish(notification) end |