Skip to content

Commit

Permalink
added conditional definition of pagy_t_with_i18n to avoid ruby 2.7 "l…
Browse files Browse the repository at this point in the history
…ast argument as keyword parameters" deprecation warning (closes #241)
  • Loading branch information
ddnexus committed May 8, 2020
1 parent d571719 commit 217c017
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/pagy/extras/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ module Frontend
Pagy::I18n.clear.instance_eval { undef :load; undef :t } # unload the pagy default constant for efficiency

alias_method :pagy_without_i18n, :pagy_t
def pagy_t_with_i18n(*args) ::I18n.t(*args) end
if Gem::Version.new(::I18n::VERSION) < Gem::Version.new('1.6.0')
def pagy_t_with_i18n(*args) ::I18n.t(*args) end
else
def pagy_t_with_i18n(key, **opts) ::I18n.t(key, **opts) end
end
alias_method :pagy_t, :pagy_t_with_i18n

end
Expand Down

0 comments on commit 217c017

Please sign in to comment.