Module: RuboCop::Formatter::TextUtil
- Included in:
- HTMLFormatter::ERBContext, SimpleTextFormatter
- Defined in:
- lib/rubocop/formatter/text_util.rb
Overview
Common logic for UI texts.
Class Method Summary collapse
Class Method Details
.pluralize(number, thing, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rubocop/formatter/text_util.rb', line 9 def pluralize(number, thing, = {}) text = '' if number == 0 && [:no_for_zero] text = 'no' else text << number.to_s end text << " #{thing}" text << 's' unless number == 1 text end |