Class: Numeric
- Inherits:
-
Object
- Object
- Numeric
- Defined in:
- lib/utility_functions.rb
Instance Method Summary collapse
Instance Method Details
#ordinal ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/utility_functions.rb', line 22 def ordinal return "#{self}th" if self.between?(10, 20) case self. % 10 when 1 then "#{self}st" when 2 then "#{self}nd" when 3 then "#{self}rd" else "#{self}th" end end |
#two_digits ⇒ Object
20 |
# File 'lib/utility_functions.rb', line 20 def two_digits; self.to_s.two_digits; end |