Sha256: 51523e9fc58ac7c2fd6f5c3439bd82940ce76deb8e3b53bb87acd50b16dad639

Contents?: true

Size: 827 Bytes

Versions: 6

Compression:

Stored size: 827 Bytes

Contents

module Integrity
  class Project
    module Helpers
      module Notifiers
        def notifies?(notifier)
          return false unless notifier = notifiers.first(:name => notifier)

          notifier.enabled?
        end

        def enabled_notifiers
          notifiers.all(:enabled => true)
        end

        def config_for(notifier)
          notifier = notifiers.first(:name => notifier)
          notifier ? notifier.config : {}
        end

        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
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
foca-integrity-0.1.9.3 lib/integrity/project/notifiers.rb
gforces-integrity-0.1.9.3 lib/integrity/project/notifiers.rb
gforces-integrity-0.1.9.4 lib/integrity/project/notifiers.rb
imbriaco-integrity-0.1.9.2.1 lib/integrity/project/notifiers.rb
imbriaco-integrity-0.1.9.2 lib/integrity/project/notifiers.rb
integrity-0.1.9.3 lib/integrity/project/notifiers.rb