>> ruby-1.8.7-p330 :007 > "one two three".truncate(7)
>> => "one ..."
>>
>> In my opinion, that space shouldn't be there.
>
>> Anyone have any thoughts on the matter?
>
> I can imagine circumstances involving fixed-width fonts where having
> an unpredictable number of characters left would be bad, and at the very
> least a POLS violation.
That's a good case. I'd counter that if the widths are important you can't use truncate because if the string is shorter than you expect it won't be padded properly anyway. Still... worth considering.
I went ahead and wrote the patch and submitted it with comments about the change in behavior. I could always add a "strip" option to get what I want.
If anyone is interested...
> And personally, the space being included doesn't bother me. :-)
Heh. It drives me crazy :)
-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.
No comments:
Post a Comment