[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

What is that method called?

David Trasbo

11/11/2008 9:17:00 AM

I need the method that has the ability to turn a long string like this:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque
pulvinar turpis a nisi. Cras id elit. Aliquam vitae pede nec lacus
elementum lacinia. Ut aliquam vehicula sem.

into a shorter string like this:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque
pulvinar turpis...

My problem is that I can't remember what the method is called. I looked
through the whole Ruby String documentation
(http://ruby-doc.org/core/classes/S...) but I couldn't find it.
Can anyone remember what it's called?
--
Posted via http://www.ruby-....

2 Answers

Clifford Heath

11/11/2008 9:57:00 AM

0

David Trasbo wrote:
> I need the method that has the ability to turn a long string... into a shorter string...
> My problem is that I can't remember what the method is called. I looked
> through the whole Ruby String documentation...

There's no such method in Ruby. You might be thinking of the
truncate method that's part of ActionView's TextHelper module.

Clifford Heath.

Peter Szinek

11/11/2008 10:04:00 AM

0

I seriously doubt this is part of standard Ruby.

You have probably seen this in ActiveSupport and/or the 'english' gem
- English::String#brief:

http://english.rubyforge.org/rdoc/classes/English/String.ht...

Cheers,
Peter

On 2008.11.11., at 10:16, David Trasbo wrote:

> I need the method that has the ability to turn a long string like
> this:
>
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque
> pulvinar turpis a nisi. Cras id elit. Aliquam vitae pede nec lacus
> elementum lacinia. Ut aliquam vehicula sem.
>
> into a shorter string like this:
>
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque
> pulvinar turpis...
>
> My problem is that I can't remember what the method is called. I
> looked
> through the whole Ruby String documentation
> (http://ruby-doc.org/core/classes/S...) but I couldn't find it.
> Can anyone remember what it's called?
> --
> Posted via http://www.ruby-....
>