Class: ESM::Notification

Inherits:
ApplicationRecord show all
Defined in:
lib/esm/model/notification.rb

Instance Method Summary collapse

Instance Method Details

#build_embed(**templates) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/esm/model/notification.rb', line 5

def build_embed(**templates)
  ESM::Embed.build do |e|
    e.title = format(notification_title, templates) if notification_title.present?
    e.description = format(notification_description, templates) if notification_description.present?

    e.color =
      if notification_color == "random"
        ESM::Color.random
      else
        notification_color
      end
  end
end