Module: Harbinger
- Defined in:
- lib/harbinger.rb,
lib/harbinger/engine.rb,
lib/harbinger/message.rb,
lib/harbinger/version.rb,
lib/harbinger/channels.rb,
lib/harbinger/reporters.rb,
lib/harbinger/exceptions.rb,
lib/harbinger/configuration.rb,
app/helpers/harbinger/application_helper.rb,
lib/harbinger/reporters/request_reporter.rb,
app/controllers/harbinger/messages_controller.rb,
app/models/harbinger/database_channel_message.rb,
app/controllers/harbinger/application_controller.rb,
lib/generators/harbinger/install/install_generator.rb,
app/models/harbinger/database_channel_message_element.rb
Defined Under Namespace
Modules: ApplicationHelper, Channels, Reporters Classes: ApplicationController, Configuration, ConfigurationError, DatabaseChannelMessage, DatabaseChannelMessageElement, Engine, InstallGenerator, Message, MessagesController
Constant Summary collapse
- VERSION =
"0.2.3"
Class Attribute Summary collapse
Class Method Summary collapse
-
.build_message(options = {}) ⇒ Object
Responsible for building a :message from the various :reporters.
-
.call(options) ⇒ Object
Responsible for building a :message from the various :reporters and then delivering the :message to the appropriate :channels.
- .configure {|configuration| ... } ⇒ Object
- .database_storage ⇒ Object
- .default_channels ⇒ Object
-
.deliver_message(message, options = {}) ⇒ Object
Responsible for delivering a :message to the appropriate :channels.
- .logger ⇒ Object
-
.table_name_prefix ⇒ Object
private
As per an isolated_namespace Rails engine.
-
.use_relative_model_naming? ⇒ Boolean
private
Because I am not using isolate_namespace for Orcid::Engine I need this for the application router to find the appropriate routes.
Class Attribute Details
.configuration ⇒ Object
13 14 15 |
# File 'lib/harbinger.rb', line 13 def configuration @configuration ||= Configuration.new end |
Class Method Details
.build_message(options = {}) ⇒ Object
Responsible for building a :message from the various :reporters.
53 54 55 56 57 58 59 |
# File 'lib/harbinger.rb', line 53 def ( = {}) reporters = Array(.fetch(:reporters)).flatten.compact = .fetch(:message) { } reporters.each { |context| reporter_for(context).accept() } end |
.call(options) ⇒ Object
Responsible for building a :message from the various :reporters and then delivering the :message to the appropriate :channels.
39 40 41 42 |
# File 'lib/harbinger.rb', line 39 def call() = () (, ) end |
.configure {|configuration| ... } ⇒ Object
22 23 24 |
# File 'lib/harbinger.rb', line 22 def configure yield(configuration) end |
.database_storage ⇒ Object
106 107 108 |
# File 'lib/harbinger.rb', line 106 def database_storage configuration.database_storage end |
.default_channels ⇒ Object
96 97 98 |
# File 'lib/harbinger.rb', line 96 def default_channels configuration.default_channels end |
.deliver_message(message, options = {}) ⇒ Object
Responsible for delivering a :message to the appropriate :channels.
70 71 72 73 74 75 76 77 |
# File 'lib/harbinger.rb', line 70 def (, = {}) channels = .fetch(:channels) { default_channels } Array(channels).flatten.compact.each do |channel_name| channel = channel_for(channel_name) channel.deliver() end true end |
.logger ⇒ Object
101 102 103 |
# File 'lib/harbinger.rb', line 101 def logger configuration.logger end |
.table_name_prefix ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
As per an isolated_namespace Rails engine. But the isolated namespace creates issues.
114 115 116 |
# File 'lib/harbinger.rb', line 114 def table_name_prefix 'harbinger_' end |
.use_relative_model_naming? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Because I am not using isolate_namespace for Orcid::Engine I need this for the application router to find the appropriate routes.
121 122 123 |
# File 'lib/harbinger.rb', line 121 def use_relative_model_naming? true end |