Module: Tnef
- Defined in:
- lib/tnef.rb,
lib/tnef/version.rb,
lib/tnef/executable.rb
Defined Under Namespace
Classes: Executable
Constant Summary collapse
- VERSION =
"1.0.2"
Class Method Summary collapse
Class Method Details
.in_tmp_dir(&block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/tnef.rb', line 22 def self.in_tmp_dir(&block) Dir.mktmpdir do |dir| FileUtils.cd(dir) do yield(dir) end end end |
.unpack(winmail_io, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tnef.rb', line 9 def self.unpack(winmail_io, &block) in_tmp_dir do |dir| IO.popen("#{Tnef::Executable.path} --number-backups --save-body --body-pref th -K", "wb") do |tnef| tnef.write(winmail_io.read) tnef.close end Dir.glob("#{dir}/*").select { |node| File.file?(node) }.sort.each do |file| yield(file) end end end |