Class String
In: lib/core_extensions.rb
Parent: Object

This file is part of TexieR - universal text to html converter.

Author

rane <rane@metatribe.org>

Copyright

Original version:

  Copyright (c) 2004-2006 David Grudl

Ruby port:

  Copyright (c) 2006 rane

Texier is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

Texier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Version

 0.1 ($Revision: 24 $ $Date: 2006-10-24 18:53:21 +0200 (Ut, 24 okt 2006) $)

Methods

Public Instance methods

Remove HTML tags, leave only plain text.

[Source]

# File lib/core_extensions.rb, line 39
    def strip_html_tags
        self.gsub(/<[^>]>/, '')
    end

Emulation of PHP’s word wrap function.

[Source]

# File lib/core_extensions.rb, line 34
    def word_wrap(width)
        self.gsub(/\n/, "\n\n").gsub(/(.{1,#{width}})(\s+|$)/, "\\1\n").strip
    end

[Validate]