Sha256: 99414af900dc0cf786f31e221dfa187d05e8e752ea92f6a7c462f76c90fe1119
Contents?: true
Size: 1.53 KB
Versions: 3
Compression:
Stored size: 1.53 KB
Contents
module Gossiper module Concerns module Decorators module Notification extend ActiveSupport::Concern included do attr_reader :notification end def initialize(notification) @notification = notification end def method_missing(method, *args, &block) notification.send(method, *args, &block) end def respond_to?(method) notification.respond_to?(method) end def kind t("gossiper.notifications.#{notification.type.underscore}.title", default: notification.type.titleize ) end def subject t("gossiper.notifications.#{notification.type.underscore}.subject", default: kind ) end def status t("gossiper.notifications.status.#{notification.status}") end def read? t(notification.read?.to_s) end def email notification.to end def delivered_at decorate_date(notification.delivered_at) end def created_at decorate_date(notification.created_at) end def updated_at decorate_date(notification.updated_at) end def email_object @email_object ||= Mailer.mail_for(notification) end private def t(*args) I18n.t(*args) end def decorate_date(date) I18n.l(date, format: :short) if date end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems