Monday, January 31, 2011

[Rails] truncate may leave trailing spaces... do you think this is wrong?

Hi all -

I noticed the other day that it's possible to truncate a string such that it has trailing spaces before it appends the omission characters. Notice the space in the output below.

ruby-1.8.7-p330 :007 > "one two three".truncate(7)
=> "one ..."

In my opinion, that space shouldn't be there.

I was going to submit tests and a patch to correct it, but was hoping to get some feedback to see if I'm wasting my time as people expect this (I can't think of a reason...).

Anyone have any thoughts on the matter?

-philip


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate