Sha256: 46a01005b308947c60c0ab9ac288fce7a20f7ba8d276b5b880d7dd4c14ad5db0

Contents?: true

Size: 706 Bytes

Versions: 14

Compression:

Stored size: 706 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
      attr_reader :signal, :data

      def initialize(signal, data: nil)
        @signal = signal
        @data = data.nil? ? {} : data.deep_symbolize_keys

        @data[:timeout] ||= 5
        @data[:type] ||= :balloon
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
signum-0.7.9 app/components/signum/notification/component.rb
signum-0.7.8 app/components/signum/notification/component.rb
signum-0.7.4 app/components/signum/notification/component.rb
signum-0.7.2 app/components/signum/notification/component.rb
signum-0.7.1 app/components/signum/notification/component.rb
signum-0.7.0 app/components/signum/notification/component.rb
signum-0.6.0 app/components/signum/notification/component.rb
signum-0.5.1 app/components/signum/notification/component.rb
signum-0.5.0 app/components/signum/notification/component.rb
signum-0.4.13 app/components/signum/notification/component.rb
signum-0.4.12 app/components/signum/notification/component.rb
signum-0.4.11 app/components/signum/notification/component.rb
signum-0.4.10 app/components/signum/notification/component.rb
signum-0.4.8 app/components/signum/notification/component.rb