Module: ActiveNotifier::Core::ClassMethods
- Defined in:
- lib/active_notifier/core.rb
Instance Method Summary collapse
-
#exec(channel, **options) ⇒ Object
Message execute.
Instance Method Details
#exec(channel, **options) ⇒ Object
Message execute
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/active_notifier/core.rb', line 30 def exec(channel, **) channel = channel&.to_sym raise ArgumentError, ":channel can't be blank" if channel.blank? template = [:template].to_s.presence || channel.to_s token = get_token(channel, [:token]) raise UndefinedTokenError if token.blank? type = [:type]&.to_sym.presence || guess_type_by_files(template) data = [:data].to_h = (template, type, data) adapter = ActiveNotifier.adapt(ActiveNotifier.config.adapter) = .except(:token, :template, :type, :data) adapter.notify(token, type, , ) end |