class DocParser
Public Class Methods
new()
click to toggle source
# File lib/file_parsers/doc_parser.rb, line 5 def initialize @content = '' end
Public Instance Methods
read_file(file_path)
click to toggle source
# File lib/file_parsers/doc_parser.rb, line 9 def read_file file_path begin word = WIN32OLE.connect( 'Word.Application' ) doc = word.activedocument rescue word = WIN32OLE.new( 'Word.Application' ) doc = word.documents.open( file_path ) end word.visible = false doc.sentences.each{ |x| @content << x.text } doc.close word.quit @content end