class Handlebars::Helpers::Inflection::Ordinal
Ordinal: The suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th
Public Instance Methods
handlebars_helper()
click to toggle source
# File lib/handlebars/helpers/inflection/ordinal.rb, line 50 def handlebars_helper proc do |_context, value| wrapper(parse(value)) end end
parse(value)
click to toggle source
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
@example
puts Ordinal.new.parse('1') st
@example
puts Ordinal.new.parse('2') nd
@example
puts Ordinal.new.parse('3') rd
@example
puts Ordinal.new.parse('4') th
@param [String] value - numeric value @return [String] ordinal suffix that would be required for a number
# 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