Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
# The following code will create a temporary file for say attaching a vcard file to email.The following code is dynamic to use ERB to create a template to create the file dynamically every time with the variable "telephone","location","email" which gets binded to the ERB file and is under scope { telephone = "347-27456" location = "New Delhi" email = "xyz@gmail.com" vcard = ERB.new( File.open('address.vcard.erb' ){ |f| f.read } ).result( binding ) f = File.new("temp_file.vcf","wb") f.puts vcard f.close }
This paste will be private.
From the Design Piracy series on my blog: