Sha256: 4d5cdbff83dd2fe71fabbb8696369fdf58753f286dadd38052f156358137c0fe
Contents?: true
Size: 540 Bytes
Versions: 19
Compression:
Stored size: 540 Bytes
Contents
# frozen_string_literal: true # Monkey patches for +Integer+ # class Integer ROMAN_NUMERALS = %w[0 i ii iii iv v vi vii viii ix x xi xii xiii xiv xv xvi xvii xviii xix xx].freeze # Formats as different types of integers, including roman numerals. # # @return [String] # 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 end
Version data entries
19 entries across 19 versions & 1 rubygems