From 8f91d61e67794373c767f476a8b41524f89ed43d Mon Sep 17 00:00:00 2001 From: Vinicius Brasil Date: Wed, 4 Sep 2019 19:30:50 -0300 Subject: [PATCH] Replace Int32 type with Int on #pluralize signature --- spec/lucky/text_helpers/pluralize_spec.cr | 1 + src/lucky/page_helpers/text_helpers.cr | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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