Scott Watermasysk Husband, Father, Bootstrapper, Developer, Builder, Shipper.

Ruby - Who Called This Method?

I wanted to add a header on all my PostMark emails. Instead of manually editing each method, I dropped this one-liner in.

headers["X-PM-Tag"] = caller[0][/.*’/][1..-2]`

Now, each email gets tagged with the current mailer method.