Sha256: 5aac1178adced51bb44682b7aceb182e22c4a382d06735f174cbba0038d1ecb9

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

class String
  def inflections
    inflections_with_names.collect(&:first)
  end

  def inflections_with_names
    returning out = [] do
      out << [self, "self"]
      out << [singularize, "singularize"]
      out << [pluralize, "pluralize"]
      out << [participlize, "participlize"]
      out << [gerundize, "gerundize"]
      out << [gerundize.pluralize, "gerundize plural"]
      out << [doerize, "doerize"]
      out << [doerize.pluralize, "doerize plural"]
      out << [adjectivize, "adjectivize"]
      out << [superlativize, "superlativize"]
      out << [superlativize(:adjective => true), "superlativize adjective"]
    end
  end

  def adjectivize
    ActiveSupport::Inflector.adjectivize(self)
  end

  def doerize
    ActiveSupport::Inflector.doerize(self)
  end

  def gerundize
    ActiveSupport::Inflector.gerundize(self)
  end

  def participlize
    ActiveSupport::Inflector.participlize(self)
  end

  def superlativize(options={})
    ActiveSupport::Inflector.superlativize(self, options)
  end

  def stem
    ActiveSupport::Inflector.stem(self)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inflectious-0.2.3 lib/inflectious/string.rb
inflectious-0.2.2 lib/inflectious/string.rb
inflectious-0.2.1 lib/inflectious/string.rb
inflectious-0.2.0 lib/inflectious/string.rb