提交 91c18554 编写于 作者: V Vijay Dev

adds code examples for negative ordinalize

上级 a8daea4b
......@@ -135,6 +135,8 @@ def constantize(camel_cased_word) #:nodoc:
# ordinalize(2) # => "2nd"
# ordinalize(1002) # => "1002nd"
# ordinalize(1003) # => "1003rd"
# ordinalize(-11) # => "-11th"
# ordinalize(-1021) # => "-1021st"
def ordinalize(number)
if (11..13).include?(number.to_i.abs % 100)
"#{number}th"
......@@ -148,4 +150,4 @@ def ordinalize(number)
end
end
end
end
\ No newline at end of file
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册