1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix integer regex deprecation warnings for Ruby 2.6.0 (#34728)

* Fix integer regex deprecation warnings for Ruby 2.6.0
* Define =~ in FakeZone to avoid warnings from Ruby 2.6.0
This commit is contained in:
Vinicius Stock 2018-12-20 21:19:41 -02:00 committed by Yuji Yaginuma
parent 788bc21ef3
commit 1ff2213313
2 changed files with 2 additions and 1 deletions

View file

@ -228,7 +228,7 @@ module ActionView
# pluralize(2, 'Person', locale: :de) # pluralize(2, 'Person', locale: :de)
# # => 2 Personen # # => 2 Personen
def pluralize(count, singular, plural_arg = nil, plural: plural_arg, locale: I18n.locale) def pluralize(count, singular, plural_arg = nil, plural: plural_arg, locale: I18n.locale)
word = if count == 1 || count =~ /^1(\.0+)?$/ word = if count == 1 || count.to_s =~ /^1(\.0+)?$/
singular singular
else else
plural || singular.pluralize(locale) plural || singular.pluralize(locale)

View file

@ -36,6 +36,7 @@ class FormOptionsHelperTest < ActionView::TestCase
module FakeZones module FakeZones
FakeZone = Struct.new(:name) do FakeZone = Struct.new(:name) do
def to_s; name; end def to_s; name; end
def =~(_re); end
end end
module ClassMethods module ClassMethods