Parent

Methods

Files

Integer

Public Instance Methods

roman() click to toggle source

Converts this integer to a roman numeral.

NOTE: This is not (presently) a common core extension and is not loaded automatically when using require 'facets'.

# File lib/facets/core-uncommon/facets/integer/roman.rb, line 27
def roman
  int = self
  #return nil if integer > ROMAN_MAX
  return "-#{(-int).roman}" if int < 0
  return "" if int == 0
  ROMAN_VALUES.each do |(i, v)|
    return(i + (int-v).roman) if v <= int 
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.