Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: israel.herraiz@gmail.com (Israel Herraiz)
Subject: [sup-talk] [PATCH] Wrap text attachments
Date: Tue, 04 Nov 2008 15:07:21 +0100	[thread overview]
Message-ID: <1225807479-sup-1191@elly> (raw)
In-Reply-To: <1225805250-sup-3958@ausone.local>

Excerpts from Nicolas's message on Nov  4, 2008 about  2 PM:
> However there is already a WRAP_LEN constant in this file, please provide
> a patch that reuse the same constant.

Find it below. I have moved the constant out of the Attachment and
Text classes, and it is now in the context of the Chunk module.

Cheers,
Israel


---
 lib/sup/message-chunks.rb |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index cc895f3..5b5c314 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -41,6 +41,8 @@ end
 
 module Redwood
 module Chunk
+  WRAP_LEN = 80 # wrap messages and text attachments at this width
+
   class Attachment
     HookManager.register "mime-decode", <<EOS
 Executes when decoding a MIME attachment.
@@ -95,6 +97,7 @@ EOS
       @lines = nil
       if text
         @lines = text.gsub("\r\n", "\n").gsub(/\t/, "        ").gsub(/\r/, "").split("\n")
+        @lines = lines.map {|l| l.chomp.wrap WRAP_LEN}.flatten
         @quotable = true
       end
     end
@@ -143,7 +146,6 @@ EOS
   end
 
   class Text
-    WRAP_LEN = 80 # wrap at this width
 
     attr_reader :lines
     def initialize lines
-- 
1.5.6.5


  reply	other threads:[~2008-11-04 14:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04  0:08 Israel Herraiz
2008-11-04 13:29 ` Nicolas Pouillard
2008-11-04 14:07   ` Israel Herraiz [this message]
2008-11-07 16:55     ` William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1225807479-sup-1191@elly \
    --to=israel.herraiz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox