Class: Cmdlet::Inflection::Ordinalize
- Inherits:
-
BaseCmdlet
- Object
- BaseCmdlet
- Cmdlet::Inflection::Ordinalize
- Defined in:
- lib/cmdlet/inflection/ordinalize.rb
Overview
Ordinalize: Turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
Instance Method Summary collapse
-
#call(value) ⇒ String
Number value turned to 1st, 2nd, 3rd, 4th etc.
Methods inherited from BaseCmdlet
Instance Method Details
#call(value) ⇒ String
Returns number value turned to 1st, 2nd, 3rd, 4th etc.
11 12 13 14 15 16 17 |
# File 'lib/cmdlet/inflection/ordinalize.rb', line 11 def call(value) return '' if value.nil? value = value.to_i if value.is_a? String value.ordinalize end |