diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-07-21 01:04:58 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-07-21 02:25:53 +0300 |
commit | 022f36769241c9e0007a3db13b047830912e0abc (patch) | |
tree | 2b76f599942ca5ec7ffe7f26e86c547fb272cdbc /app | |
parent | 93c69c4d42330023efd610816add314048475cb5 (diff) |
Fix some keyword args for ruby 3 compatibility
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/notifications_helper.rb | 6 | ||||
-rw-r--r-- | app/mailers/report_mailer.rb | 2 | ||||
-rw-r--r-- | app/presenters/base_presenter.rb | 8 |
3 files changed, 10 insertions, 6 deletions
diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index ffe10a951..6972d811c 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -20,11 +20,11 @@ module NotificationsHelper opts.merge!(opts_for_birthday(note)) end end - translation(target_type, opts) + translation(target_type, **opts) end - def translation(target_type, opts = {}) - t("#{target_type}", opts).html_safe + def translation(target_type, **kwargs) + t(target_type, **kwargs).html_safe # rubocop:disable Rails/OutputSafety end def opts_for_post(post) diff --git a/app/mailers/report_mailer.rb b/app/mailers/report_mailer.rb index ad69332fd..851635562 100644 --- a/app/mailers/report_mailer.rb +++ b/app/mailers/report_mailer.rb @@ -26,7 +26,7 @@ class ReportMailer < ApplicationMailer private def format(resource) - body = I18n.t("notifier.report_email.body", resource) + body = I18n.t("notifier.report_email.body", **resource) mail(to: resource[:email], subject: I18n.t("notifier.report_email.subject", type: resource[:type])) do |format| format.html { render "notifier/plain_markdown_email", locals: {body: body} } format.text { render "notifier/plain_markdown_email", locals: {body: body} } diff --git a/app/presenters/base_presenter.rb b/app/presenters/base_presenter.rb index 5a55d147f..d4eac8ce1 100644 --- a/app/presenters/base_presenter.rb +++ b/app/presenters/base_presenter.rb @@ -20,8 +20,12 @@ class BasePresenter @current_user = curr_user end - def method_missing(method, *args) - @presentable.public_send(method, *args) + def respond_to_missing?(method, include_private=false) + @presentable.respond_to?(method) || super + end + + def method_missing(method, *args, **kwargs) # rubocop:disable Lint/MissingSuper + @presentable.public_send(method, *args, **kwargs) end class NilPresenter |