diff --git a/spec/lucky/text_helpers/pluralize_spec.cr b/spec/lucky/text_helpers/pluralize_spec.cr index 9477f560b..3bf90e5e6 100644 --- a/spec/lucky/text_helpers/pluralize_spec.cr +++ b/spec/lucky/text_helpers/pluralize_spec.cr @@ -5,6 +5,7 @@ describe Lucky::TextHelpers do it "pluralizes words" do view.pluralize(1, "count").should eq "1 count" view.pluralize(2, "count").should eq "2 counts" + view.pluralize(1000000000000, "count").should eq "1000000000000 counts" view.pluralize("1", "count").should eq "1 count" view.pluralize("2", "count").should eq "2 counts" view.pluralize("1,066", "count").should eq "1,066 counts" diff --git a/src/lucky/page_helpers/text_helpers.cr b/src/lucky/page_helpers/text_helpers.cr index a36461b0a..422f74da3 100644 --- a/src/lucky/page_helpers/text_helpers.cr +++ b/src/lucky/page_helpers/text_helpers.cr @@ -86,7 +86,7 @@ module Lucky::TextHelpers # It pluralizes `singular` unless `count` is 1. You can specify the `plural` option # to override the chosen plural word. - def pluralize(count : Int32 | String | Nil, singular : String, plural = nil) : String + def pluralize(count : Int | String | Nil, singular : String, plural = nil) : String word = if (count == 1 || count =~ /^1(\.0+)?$/) singular else