Module: Integrity::Project::Helpers::Notifiers
- 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
15 16 17 18 |
# File 'lib/integrity/project/notifiers.rb', line 15 def config_for(notifier) notifier = notifiers.first(:name => notifier) notifier ? notifier.config : {} end |
#enabled_notifiers ⇒ Object
11 12 13 |
# File 'lib/integrity/project/notifiers.rb', line 11 def enabled_notifiers notifiers.all(:enabled => true) end |
#notifies?(notifier) ⇒ Boolean
5 6 7 8 9 |
# File 'lib/integrity/project/notifiers.rb', line 5 def notifies?(notifier) return false unless notifier = notifiers.first(:name => notifier) notifier.enabled? end |
#update_notifiers(to_enable, config) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/integrity/project/notifiers.rb', line 20 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 |