Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Multiple execution of before-edit hook
@ 2011-01-03 19:34 Matthias Vallentin
  0 siblings, 0 replies; only message in thread
From: Matthias Vallentin @ 2011-01-03 19:34 UTC (permalink / raw)
  To: Sup Talk

I noticed that before-edit is executed several times when replying:

    @headers.each do |k, v|
      @bodies[k] = body
      HookManager.run "before-edit", :header => v, :body => @bodies[k]
    end

What's the rational behind this? Why not invoking the hook once, for all
headers and the body. (Also, the hook is executed again in the parent
class EditMessageMode.) Since I use the hook to append some text at the
end of the body

    body << "foo"

the text is added multiple times. Currently I use a crude hack to avoid
the duplicate appending by

    body << "foo" unless body.last == "foo"

but I wonder whether this behavior is intentional.

    Matthias
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-03 19:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-03 19:34 [sup-talk] Multiple execution of before-edit hook Matthias Vallentin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox