class Handlebars::Helpers::Inflection::Singularize

The reverse of pluralize, returns the singular form of a word in a string

Public Instance Methods

parse(value) click to toggle source

Parse will reverse of pluralize, returns the singular form of a word in a string

@example

puts Singularize.new.parse('names')

name

puts Singularize.new.parse('octopi')

octopus

@return [String] plural value turned to singular value

# File lib/handlebars/helpers/inflection/singularize.rb, line 27
def parse(value)
  return '' if value.nil?

  value = value.to_s if value.is_a?(Symbol)

  value.singularize
end