Sha256: 4cbf300dff7451b06e1e48c95591e9f3296dc8925184f5408f19fe9d6101eee8

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true

# @param type [String] Classic notification type `error`, `alert` and `info` + custom `success`
# @param data [String, Hash] `String` for backward compatibility,
#   `Hash` for the new functionality `{title: '', body: '', timeout: 5, countdown: false, action: { url: '', method: '', name: ''}}`.
#   The `title` attribute for `Hash` is mandatory.
module Signum
  module Notification
    class Component < ViewComponent::Base
      def initialize(signal, data: nil)
        @signal = signal
        @data = data.nil? ? {} : data.deep_symbolize_keys
        @data[:timeout] ||= 5
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
signum-0.3.12 app/components/signum/notification/component.rb