Robert Walker wrote in post #978946:
> Philip Hallstrom wrote in post #978930:
>> 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...
>>
>>
>
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6357-patch-to-remove-trailing-spaces-from-truncate-result
>
> This might be fine for English (or English like) strings, but not all
> language necessarily separate words by space characters.
>
> Truncate is not strip. It probably should not make this assumption.
Oh! I forgot to mention that truncate already includes the :separator
option:
truncate("Once upon a time in a world far far away", :length => 17,
:separator => ' ')
--
Posted via http://www.ruby-forum.com/.
--
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