Class: RTF

Inherits:
Object
  • Object
show all
Defined in:
lib/rtftopdf.rb

Instance Method Summary collapse

Constructor Details

#initialize(rtf_content) ⇒ RTF

Returns a new instance of RTF.



6
7
8
# File 'lib/rtftopdf.rb', line 6

def initialize rtf_content
  @rtf_content = rtf_content
end

Instance Method Details

#to_htmlObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/rtftopdf.rb', line 10

def to_html
  temporary_rtf_file = Tempfile.new('RTF')
  temporary_rtf_file.write(@rtf_content)
  temporary_rtf_file.close

  html_content = `unrtf #{temporary_rtf_file.path}`
  temporary_rtf_file.unlink

  html_content
end