我喜欢pluralize
Rails 中的方法。我希望小数有类似的机制,它们可以更易于人类阅读。例如,这将是理想的:
> include ActionView::Helpers::TextHelper
> pluralize(2.0, 'donut')
=> "2.0 donuts"
> pluralize_and_humanize(2.0, 'donut')
=> "2 donuts"
> pluralize_and_humanize(2.5, 'donut')
=> "2 and a half donuts"
> pluralize_and_humanize(1.0, 'donut')
=> "1 donut"
> pluralize_and_humanize(0.5, 'donut')
=> "half a donut"
> pluralize_and_humanize(0.75, 'donut')
=> "3/4 of a donut"
有什么内置在rails中的吗?我可以使用任何宝石吗?