Class: Tocsin::Config
- Inherits:
-
Object
- Object
- Tocsin::Config
- Defined in:
- lib/tocsin/config.rb
Instance Attribute Summary collapse
-
#exception_level ⇒ Object
Returns the value of attribute exception_level.
-
#from_address ⇒ Object
Returns the value of attribute from_address.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#mailer ⇒ Object
Returns the value of attribute mailer.
-
#mailer_method ⇒ Object
Returns the value of attribute mailer_method.
-
#queue ⇒ Object
Returns the value of attribute queue.
-
#recipient_groups ⇒ Object
Returns the value of attribute recipient_groups.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#notify(recipients, parameters) ⇒ Object
notify [r1, r2], :of => filters, :by => notifier.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
5 6 7 8 9 10 11 |
# File 'lib/tocsin/config.rb', line 5 def initialize @exception_level = StandardError @logger = select_logger @mailer = select_mailer @mailer_method = select_mailer_method @queue = :high end |
Instance Attribute Details
#exception_level ⇒ Object
Returns the value of attribute exception_level.
3 4 5 |
# File 'lib/tocsin/config.rb', line 3 def exception_level @exception_level end |
#from_address ⇒ Object
Returns the value of attribute from_address.
3 4 5 |
# File 'lib/tocsin/config.rb', line 3 def from_address @from_address end |
#logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/tocsin/config.rb', line 3 def logger @logger end |
#mailer ⇒ Object
Returns the value of attribute mailer.
3 4 5 |
# File 'lib/tocsin/config.rb', line 3 def mailer @mailer end |
#mailer_method ⇒ Object
Returns the value of attribute mailer_method.
3 4 5 |
# File 'lib/tocsin/config.rb', line 3 def mailer_method @mailer_method end |
#queue ⇒ Object
Returns the value of attribute queue.
3 4 5 |
# File 'lib/tocsin/config.rb', line 3 def queue @queue end |
#recipient_groups ⇒ Object
Returns the value of attribute recipient_groups.
3 4 5 |
# File 'lib/tocsin/config.rb', line 3 def recipient_groups @recipient_groups end |
Instance Method Details
#notify(recipients, parameters) ⇒ Object
notify [r1, r2], :of => filters, :by => notifier
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tocsin/config.rb', line 14 def notify(recipients, parameters) self.recipient_groups ||= [] recipients = [recipients] unless recipients.is_a? Array filters = parameters[:of] || {} notifier = parameters[:by] || Tocsin::Notifiers.default_notifier group_config = { :recipients => recipients, :notifier => notifier}.merge(filters) self.recipient_groups.push(group_config) end |