Module: Integrity::Project::Notifiers
- Included in:
- Integrity::Project
- Defined in:
- lib/integrity/project/notifiers.rb
Instance Method Summary collapse
- #config_for(notifier) ⇒ Object
- #enabled_notifiers ⇒ Object
- #notifies?(notifier) ⇒ Boolean
- #update_notifiers(to_enable, config) ⇒ Object
Instance Method Details
#config_for(notifier) ⇒ Object
14 15 16 17 |
# File 'lib/integrity/project/notifiers.rb', line 14 def config_for(notifier) notifier = notifiers.first(:name => notifier) notifier ? notifier.config : {} end |
#enabled_notifiers ⇒ Object
10 11 12 |
# File 'lib/integrity/project/notifiers.rb', line 10 def enabled_notifiers notifiers.all(:enabled => true) end |
#notifies?(notifier) ⇒ Boolean
4 5 6 7 8 |
# File 'lib/integrity/project/notifiers.rb', line 4 def notifies?(notifier) return false unless notifier = notifiers.first(:name => notifier) notifier.enabled? end |
#update_notifiers(to_enable, config) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/integrity/project/notifiers.rb', line 19 def update_notifiers(to_enable, config) config.each_pair { |name, config| notifier = notifiers.first(:name => name) notifier ||= notifiers.new(:name => name) notifier.enabled = to_enable.include?(name) notifier.config = config notifier.save } end |