Sha256: 379de26c8fe18e466ecdeb2df4f6225d705a0f1265261aa3c22b88a888e6c179

Contents?: true

Size: 483 Bytes

Versions: 1

Compression:

Stored size: 483 Bytes

Contents

require "active_model"
require_relative "model" unless defined?(ActiveModel::Model)

module MultiNotifier
  class Adapter
    include ActiveModel::Model

    def notify
      raise "Implement #{self.class.name}#notify"
    end

    def notify!
      raise error_msg(errors.messages) unless valid?

      notify
    end

    private

    def error_msg(messages)
      messages.map do |key, value|
        value.map { |v| "#{key} #{v}" }
      end.flatten.join("\n")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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