Sha256: fa9165fa0869837327fae0e48b52d1894c1e8fccb88b9702379ffcbab5e67ae7

Contents?: true

Size: 526 Bytes

Versions: 4

Compression:

Stored size: 526 Bytes

Contents

require 'numbers_in_words'

module Skr

    module Number

        def self.ordinalize(number)
            if (11..13).include?(number % 100)
                "#{number}th"
            else
                case number % 10
                when 1; "#{number}st"
                when 2; "#{number}nd"
                when 3; "#{number}rd"
                else    "#{number}th"
                end
            end
        end

        def self.as_words(number)
            NumbersInWords.in_words(number)
        end
    end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stockor-0.5.0 lib/skr/number.rb
stockor-0.4.0 lib/skr/number.rb
stockor-0.3.0 lib/skr/number.rb
stockor-0.2 lib/skr/number.rb