app/components/signum/notification/component.rb in signum-0.3.12 vs app/components/signum/notification/component.rb in signum-0.4.8

- old
+ new

@@ -5,13 +5,17 @@ # `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