Class: DocRipper::TextRipper

Inherits:
Ripper::Base show all
Defined in:
lib/doc_ripper/text_ripper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ripper::Base

#initialize

Constructor Details

This class inherits a constructor from DocRipper::Ripper::Base

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



5
6
7
# File 'lib/doc_ripper/text_ripper.rb', line 5

def file_path
  @file_path
end

#text_file_pathObject (readonly)

Returns the value of attribute text_file_path.



5
6
7
# File 'lib/doc_ripper/text_ripper.rb', line 5

def text_file_path
  @text_file_path
end

Instance Method Details

#ripObject



7
8
9
# File 'lib/doc_ripper/text_ripper.rb', line 7

def rip
  @is_ripped ||=choose_ripper
end

#textObject



11
12
13
# File 'lib/doc_ripper/text_ripper.rb', line 11

def text
  @text ||= IO.read(@text_file_path).force_encoding("ISO-8859-1").encode("utf-8", replace: nil) if rip
end