cadmium_inflector

Version, currently 0.2.01 version
  • 0.2.0latestJan 9, 2026

github.com/cadmiumcr/inflector

No description declared in shard.yml.

0 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  cadmium_inflector:
    github: cadmiumcr/inflector
    version: ~> 0.2.0

Then run:

shards install

shard.yml

Crystal
0.30.1
License
MIT
Author
Chris Watson

Dependencies

This version declares no dependencies.

README

Inflector

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      cadmium_inflector:
        github: cadmiumcr/inflector
  2. Run shards install

Usage

require "cadmium_inflector"

Nouns

Nouns can be inflected using the NounInflector which has also been attached to the String class.

inflector = Cadmium.noun_inflector.new

inflector.pluralize("radius")
# => radii

inflector.singularize("radii")
# => radius

"person".pluralize
# => people

"people".singularize
# => person

Present Tense Verbs

Present tense verbs can be inflected with the PresentVerbInflector. This has also been attached to the string class.

inflector = Cadmium.present_verb_inflector.new

inflector.singularize("become")
# => became

inflector.pluralize("became")
# => become

"walk".singularize(false) # noun: false
# => walks

"walks".pluralize(false)  # noun: false
# => walk

Numbers

Numbers can be inflected with the CountInflector which also adds a method to_nth to the Int class.

Cadmium.count_inflector.nth(1)
# => 1st

Cadmium.count_inflector.nth(111)
# => 111th

153.to_nth
# => 153rd

Contributing

  1. Fork it (https://github.com/your-github-user/cadmium_inflectors/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors