Method: Codebot::Formatter#format_number

Defined in:
lib/codebot/formatter.rb

#format_number(num, singular = nil, plural = nil) ⇒ String

Formats a number.

Parameters:

  • num (Integer)

    the number

  • singular (String, nil) (defaults to: nil)

    the singular noun to append to the number

  • plural (String, nil) (defaults to: nil)

    the plural noun to append to the number

Returns:

  • (String)

    the formatted number



85
86
87
88
# File 'lib/codebot/formatter.rb', line 85

def format_number(num, singular = nil, plural = nil)
  bold_num = ::Cinch::Formatting.format(:bold, num.to_s)
  (bold_num + ' ' + (num == 1 ? singular : plural).to_s).strip
end