Skip to content

Commit

Permalink
Replace Int32 type with Int on #pluralize signature (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vini Brasil authored and paulcsmith committed Sep 4, 2019
1 parent 9b8eac6 commit d05516d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/lucky/text_helpers/pluralize_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/lucky/page_helpers/text_helpers.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d05516d

Please sign in to comment.