# # email_template.rb # RubyFrictionless # # Created by Pierce T. Wetter III on 3/18/08. # Copyright (c) 2008 __MyCompanyName__. All rights reserved. # class Email_Template @@template=ERB.new <<-EOF <%= note %> <%= extraText %> --------------------------------------------------------------------------- This is an email sent to you by <%= myName %> generated by Frictionless. <%= myName %> will follow-up on this item in <%= delayText %>. If you complete this item before then, simply reply to this email and <%= myName %>'s copy of Frictionless will mark it done automatically, saving you both time. --------------------------------------------------------------------------- If you'd like to try it (Macintosh only), Frictionless is available for free here: http://www.twinforces.com/frictionless --------------------------------------------------------------------------- Special Text for Frictionless: uid: <%= action.uniqueID %> EOF # values: <%= action.currentValues.descriptionWithLocale(nil) %> too much stuff with this, recursed too far! attr_accessor :delay,:action,:extraText def action print "action called #{@action.name} #{@action.uniqueID}\n" @action end def note print "note called\n" @action.note if @action.note? end def extraText print "extra text #{@extraText}\n" @extraText end def delayText if @delay.intValue > 1 "#{@delay} days" else "1 day" end end def emailtext(act,text,delay) @delay=delay @action=act @extraText=text print "text #{text}\n" @@template.result(binding()) end def myName myself = ABAddressBook.sharedAddressBook.me result="#{myself.valueForProperty('First')} #{myself.valueForProperty('Last')}" end end