ROMAN_MAX | = | 3999 unless const_defined?(:ROMAN_MAX) | ||
ROMAN_VALUES | = | [ ["M", 1000], ["CM", 900], ["D", 500], ["CD", 400], ["C", 100], ["XC", 90], ["L", 50], ["XL", 40], ["X", 10], ["IX", 9], ["V", 5], ["IV", 4], ["I", 1] |
Is bitmask set?
7.bitmask?(7) #=> true 7.bitmask?(5) #=> true 8.bitmask?(3) #=> false
CREDIT: George Moschovitis
Is self a multiple of a given number?
7.multiple?(2) #=> false 8.multiple?(2) #=> true
CREDIT: Trans
Like times but returns a collection of the yield results.
a = 3.of { |i| "#{i+1}" } a #=> [ "1", "2", "3" ]
Converts this integer to a roman numeral.
NOTE: This method is not a common core extension and is not loaded automatically when using require ‘facets‘.
@uncommon
require 'facets/integer/roman'