All Projects → infertux → Ordinalize_full

infertux / Ordinalize_full

Licence: mit
Turns a number into an ordinal string such as first, second, third or 1st, 2nd, 3rd.

Programming Languages

ruby
36898 projects - #4 most used programming language
language
365 projects

Projects that are alternatives of or similar to Ordinalize full

Ifme
Free, open source mental health communication web app to share experiences with loved ones
Stars: ✭ 1,147 (+19016.67%)
Mutual labels:  i18n, rails
Tapping device
TappingDevice makes objects tell you what they do, so you don't need to track them yourself.
Stars: ✭ 296 (+4833.33%)
Mutual labels:  rails, rubygem
Translate enum
Easily Translate Enums in Rails
Stars: ✭ 90 (+1400%)
Mutual labels:  i18n, rails
Dry Rails
The official dry-rb railtie
Stars: ✭ 142 (+2266.67%)
Mutual labels:  rails, rubygem
Materialize Sass
Materializecss rubygem for Rails Asset Pipeline / Sprockets
Stars: ✭ 785 (+12983.33%)
Mutual labels:  rails, rubygem
Ununiga
[은는이가] 한글 조사(助詞) 대응 I18n engine extension
Stars: ✭ 34 (+466.67%)
Mutual labels:  i18n, rails
gettext i18n rails js
Extends gettext_i18n_rails making your .PO files available to client side javascript as JSON
Stars: ✭ 28 (+366.67%)
Mutual labels:  i18n, rubygem
Rails server timings
Server Timing headers for Rails apps
Stars: ✭ 112 (+1766.67%)
Mutual labels:  rails, rubygem
Strip attributes
🔪 An ActiveModel extension that automatically strips all attributes of leading and trailing whitespace before validation. If the attribute is blank, it strips the value to nil.
Stars: ✭ 441 (+7250%)
Mutual labels:  rails, rubygem
Spree i18n
I18n translation files for Spree Commerce.
Stars: ✭ 338 (+5533.33%)
Mutual labels:  i18n, rails
Notifications Rails
A flexible notification library supporting the delivery to external services, rendering in various environments, and user configuration by category.
Stars: ✭ 130 (+2066.67%)
Mutual labels:  rails, rubygem
Maily
📫 Rails Engine to preview emails in the browser
Stars: ✭ 502 (+8266.67%)
Mutual labels:  rails, rubygem
Activeinteractor
An implementation of the command pattern for Ruby with ActiveModel::Validations inspired by the interactor gem. Rich support for attributes, callbacks, and validations, and thread safe performance methods.
Stars: ✭ 118 (+1866.67%)
Mutual labels:  rails, rubygem
Texterify
The localization management system.
Stars: ✭ 37 (+516.67%)
Mutual labels:  i18n, rails
Apple id
Sign in with Apple backend library in Ruby
Stars: ✭ 115 (+1816.67%)
Mutual labels:  rails, rubygem
I18n Debug
Ever wondered which translations are being looked up by Rails, a gem, or simply your app? Wonder no more!
Stars: ✭ 143 (+2283.33%)
Mutual labels:  i18n, rails
Karafka
Framework for Apache Kafka based Ruby and Rails applications development.
Stars: ✭ 1,223 (+20283.33%)
Mutual labels:  rails, rubygem
Graphql devise
GraphQL interface on top devise_token_auth
Stars: ✭ 100 (+1566.67%)
Mutual labels:  rails, rubygem
Clearance
Rails authentication with email & password.
Stars: ✭ 3,467 (+57683.33%)
Mutual labels:  rails, rubygem
Matestack Ui Core
Matestack enables you to create sophisticated, reactive UIs in pure Ruby, without touching JavaScript and HTML. You end up writing 50% less code while increasing productivity, maintainability and developer happiness.
Stars: ✭ 469 (+7716.67%)
Mutual labels:  rails, rubygem

OrdinalizeFull

Build Status Gem Version

Like Rails' ordinalize method but with the ability to return the ordinal string spelled out in full words such as "first", "second", "third".

Features:

  • i18n support
  • doesn't monkey-patch
  • easy to integrate with Rails but doesn't require Rails
  • less than 50 lines of code

Usage

Monkey-patching Integer (like Rails does)

require "ordinalize_full/integer"

42.ordinalize_in_full #=> "forty second"
42.ordinalize_full #=> "forty second"
42.ordinalize(in_full: true) #=> "forty second"
42.ordinalize #=> "42nd"

I18n.locale = :fr
42.ordinalize_in_full #=> "quarante-deuxième"
42.ordinalize #=> "42ème"

I18n.locale = :es
14.ordinalize_in_full(gender: :feminine, plurality: :plural) #=> decimocuartas
1.ordinalize_in_full #=> primer // default masculine, singular
22.ordinalize_in_full(gender: :feminine) #=> vigésima segunda // default singular
1.ordinalize #=> 1.ᵉʳ
55.ordinalize #=> 55.ᵒ

Without monkey-patching

require "ordinalize_full"

42.ordinalize_in_full #=> NoMethodError: undefined method `ordinalize_in_full' for 42:Fixnum

class MyIntegerLikeClass; include OrdinalizeFull; def to_s; "42"; end; end #=> :to_s
MyIntegerLikeClass.new.ordinalize_in_full #=> "forty second"

Limitations

  • only works up to 100 (for now)
  • locales only available in English, French, Italian, Spanish, and Dutch (pull requests welcome!)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].