class Integer

Monkey patches for Integer

Constants

ROMAN_NUMERALS

Public Instance Methods

to_format(format) click to toggle source

Formats as different types of integers, including roman numerals.

@return [String]

# File lib/kitchen/patches/integer.rb, line 12
def to_format(format)
  case format
  when :arabic
    to_s
  when :roman
    raise 'Unknown conversion to Roman numerals' if self >= ROMAN_NUMERALS.size

    ROMAN_NUMERALS[self]
  else
    raise 'Unknown integer format'
  end
end