Skip to content

Instantly share code, notes, and snippets.

@Jamedjo
Created December 24, 2013 23:59
Show Gist options
  • Save Jamedjo/8118942 to your computer and use it in GitHub Desktop.
Save Jamedjo/8118942 to your computer and use it in GitHub Desktop.
class VntReader
def initialize(file)
@file=file
end
def body
@file.each_line.select{|l|l.match /\ABODY/}.first.chomp
end
def content
body.match(/\ABODY.*QUOTED-PRINTABLE:(.*)/)[1]
end
def decoded_content
content.unpack('M').first
end
end
p Dir.glob('*.vnt').map{|filename| File.open(filename,'r'){|f| VntReader.new(f).decoded_content }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment