Module RDig::ContentExtractors::ExternalAppHelper
In: lib/rdig/content_extractors.rb

to be used by concrete implementations having a get_content class method that takes a path to a file and return the textual content extracted from that file.

Methods

as_file   can_do   process  

Public Instance methods

[Source]

    # File lib/rdig/content_extractors.rb, line 59
59:       def as_file(content)
60:         file = Tempfile.new('rdig')
61:         file << content
62:         file.close
63:         yield file
64:         file.delete
65:       end

setting @available according to presence of external executables in initializer of ContentExtractor is needed to make this work

[Source]

    # File lib/rdig/content_extractors.rb, line 69
69:       def can_do(content_type)
70:         @available and super(content_type)
71:       end

[Source]

    # File lib/rdig/content_extractors.rb, line 51
51:       def process(content)
52:         result = {}
53:         as_file(content) do |file|
54:           result[:content] = get_content(file.path).strip
55:         end
56:         result
57:       end

[Validate]