Sha256: 81ec116a2e125543a90732326e764ab21d69b0d6b43770e188cc574b4f9d9e6b

Contents?: true

Size: 599 Bytes

Versions: 6

Compression:

Stored size: 599 Bytes

Contents

module Adminpanel
  module PluralizationsHelper

    def pluralize_es(string)
      pluralized_string = ""
      string.split.each do |word|
        case(word.last)
          when 'a', 'e', 'i', 'o', 'u', 'c'
            pluralized_string = "#{pluralized_string}#{word}s "
          when 'b', 'r'
            pluralized_string = "#{pluralized_string}#{word}es "
          when 'z'
            pluralized_string = "#{pluralized_string}#{word.chop}ces "
          else
            pluralized_string = "#{pluralized_string}#{word} "
        end
      end
      pluralized_string.chop
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adminpanel-1.2.10 app/helpers/adminpanel/pluralizations_helper.rb
adminpanel-1.2.9 app/helpers/adminpanel/pluralizations_helper.rb
adminpanel-1.2.8 app/helpers/adminpanel/pluralizations_helper.rb
adminpanel-1.2.7 app/helpers/adminpanel/pluralizations_helper.rb
adminpanel-1.2.6 app/helpers/adminpanel/pluralizations_helper.rb
adminpanel-1.2.5 app/helpers/adminpanel/pluralizations_helper.rb