Sha256: ce4f710dd96e37a855688933ad3915e5f172ff5924e4a773e73d40f181cde109

Contents?: true

Size: 793 Bytes

Versions: 14

Compression:

Stored size: 793 Bytes

Contents

class Integer
  # Ordinalize turns a number into an ordinal string used to denote the
  # position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
  #
  #  1.ordinalize     # => "1st"
  #  2.ordinalize     # => "2nd"
  #  1002.ordinalize  # => "1002nd"
  #  1003.ordinalize  # => "1003rd"
  #  -11.ordinalize   # => "-11th"
  #  -1001.ordinalize # => "-1001st"
  def ordinalize
    MotionSupport::Inflector.ordinalize(self)
  end

  # Ordinal returns the suffix used to denote the position
  # in an ordered sequence such as 1st, 2nd, 3rd, 4th.
  #
  #  1.ordinal     # => "st"
  #  2.ordinal     # => "nd"
  #  1002.ordinal  # => "nd"
  #  1003.ordinal  # => "rd"
  #  -11.ordinal   # => "th"
  #  -1001.ordinal # => "st"
  def ordinal
    MotionSupport::Inflector.ordinal(self)
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
motion-support-1.2.1 motion/core_ext/integer/inflections.rb
motion-support-1.1.1 motion/core_ext/integer/inflections.rb
motion-support-1.2.0 motion/core_ext/integer/inflections.rb
motion-support-1.1.0 motion/core_ext/integer/inflections.rb
motion-support-1.0.0 motion/core_ext/integer/inflections.rb
motion-support-0.3.0 motion/core_ext/integer/inflections.rb
motion_blender-support-0.2.8 motion/core_ext/integer/inflections.rb
motion_blender-support-0.2.7 motion/core_ext/integer/inflections.rb
motion-support-0.2.6 motion/core_ext/integer/inflections.rb
motion-support-0.2.5 motion/core_ext/integer/inflections.rb
motion-support-0.2.4 motion/core_ext/integer/inflections.rb
motion-support-0.2.3 motion/core_ext/integer/inflections.rb
motion-support-0.2.2 motion/core_ext/integer/inflections.rb
motion-support-0.2.0 motion/core_ext/integer/inflections.rb