Class: Handlebars::Helpers::Inflection::Ordinal
- Inherits:
-
BaseHelper
- Object
- BaseHelper
- Handlebars::Helpers::Inflection::Ordinal
- Defined in:
- lib/handlebars/helpers/inflection/ordinal.rb
Overview
Ordinal: The suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th
Instance Method Summary collapse
- #handlebars_helper ⇒ Object
-
#parse(value) ⇒ String
Parse will Ordinal: The suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
Methods inherited from BaseHelper
#parse_json, #struct_to_hash, #tokenizer, #wrapper
Instance Method Details
#handlebars_helper ⇒ Object
50 51 52 53 54 |
# File 'lib/handlebars/helpers/inflection/ordinal.rb', line 50 def proc do |_context, value| wrapper(parse(value)) end end |
#parse(value) ⇒ String
Parse will Ordinal: The suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th
42 43 44 45 46 47 48 |
# File 'lib/handlebars/helpers/inflection/ordinal.rb', line 42 def parse(value) return '' if value.nil? value = value.to_i if value.is_a? String value.ordinal end |