Sha256: b55077a7475edb278cec7622df808cff107fe7b4bc993710d540c9bac0433913

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

require "active_support"

module MultiNotifier
  class Builder
    attr_reader :adapters

    def initialize
      @adapters = []
    end

    def adapter(type, configs = {})
      require "multi_notifier/adapters/#{type}"
      adapter = "MultiNotifier::Adapters::#{type.to_s.classify}".constantize
      adapters << adapter.new(configs)

      adapter
    end

    def notify_all!
      adapters.each do |adapter|
        begin
          adapter.notify!
        rescue => e
          puts "#{adapter.class.name} has error #{e.inspect}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi_notifier-0.0.1 lib/multi_notifier/builder.rb