Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] a few sup newbie questions
Date: Fri, 02 Jan 2009 04:53:24 -0800	[thread overview]
Message-ID: <1230900174-sup-3836@entry> (raw)
In-Reply-To: <1230630305-sup-9424@audrey>

Reformatted excerpts from marianne.promberger+sup-talk's message of 2008-12-30:
> Thanks. Any chance you could give me a pointer on how I can get it to
> "return a person"?
> 
> I've tried stuff like ... (in ~/.sup/hook/reply-from.rb)
> 
> if message.to =~ /rubyforge/
>   hook_reply_from = "My Name <email at domain.com>"
> end
> 
> if message.recipient_email =~ /rubyforge/
>    return "My name <email at domain.com>"
> end
> 
> ... with different variations of patterns I'm testing for and with
> different returned strings. 

You can create a person from a string by using this method:

  PersonManager.person_for "My name <email at domain.com>"

You can give it any valid email address, and it takes care of returning
the same Person object for duplicate addresses.

Brief Ruby aside: If you're going to be doing a lot of such comparisons,
you can structure the hook like:

  PersonManager.person_for case
    when message.to =~ /rubyforge/
      "My name <email at email1.org>"
    when message.recipient_email =~ /rubyforge/
      "My name <email at email2.org>"
    else
      "My name <default at default.org>"
  end

Note that the return statement isn't required (the final value of the
hook is used), and multiple if-then's can be collapsed into a case
statement.

> Any pointers appreciated! (Including general information where I could
> RTFM ..  I looked at "sup -l" but that's pretty brief.

Sadly, there's no good documentation for this right now beyond asking on
the mailing list. (Well besides learning Ruby and looking at the code.)
I'm sorry about that.
-- 
William <wmorgan-sup at masanjin.net>


      reply	other threads:[~2009-01-02 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-17 21:37 Marianne Promberger
2008-12-17 22:46 ` William Morgan
2008-12-29 17:27   ` Marianne
2008-12-29 18:10     ` Marc Hartstein
2008-12-30  9:53       ` Marianne
2009-01-02 12:53         ` William Morgan [this message]

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=1230900174-sup-3836@entry \
    --to=wmorgan-sup@masanjin.net \
    /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