Module: Thumblemonks::Indico

Defined in:
lib/thumblemonks/indico/io_helpers.rb,
lib/thumblemonks/indico/text_extractor.rb,
lib/thumblemonks/indico/extracted_document.rb,
lib/thumblemonks/indico/text_extractor/handlers/pdf_document.rb,
lib/thumblemonks/indico/text_extractor/handlers/rtf_document.rb,
lib/thumblemonks/indico/text_extractor/handlers/html_document.rb,
lib/thumblemonks/indico/text_extractor/handlers/text_document.rb,
lib/thumblemonks/indico/text_extractor/handlers/word_document.rb

Defined Under Namespace

Modules: IOHelpers Classes: ExtractedDocument, HTMLDocument, PDFDocument, RTFDocument, TextDocument, UnknownTypeError, WordDocument

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.document_handlersObject

Returns the value of attribute document_handlers.



6
7
8
# File 'lib/thumblemonks/indico/text_extractor.rb', line 6

def document_handlers
  @document_handlers
end

.known_typesObject

Returns the value of attribute known_types.



6
7
8
# File 'lib/thumblemonks/indico/text_extractor.rb', line 6

def known_types
  @known_types
end

Class Method Details

.add_handler(handler_class, options) ⇒ Object



23
24
25
26
# File 'lib/thumblemonks/indico/text_extractor.rb', line 23

def self.add_handler(handler_class, options)
  document_handlers.merge!(options[:type] => handler_class)
  known_types.merge!(options[:type] => Array(options[:extensions]))
end

.build_document(options) ⇒ Object



14
15
16
# File 'lib/thumblemonks/indico/text_extractor.rb', line 14

def self.build_document(options)
  pick_document_class(options[:type]).new(options[:content])
end

.load_handlers!Object

Called from an initializer in config/initializers



19
20
21
# File 'lib/thumblemonks/indico/text_extractor.rb', line 19

def self.load_handlers!
  Dir["#{handler_dir}/handlers/*_document.rb"].each {|handler| require(handler)}
end

.type_known?(mime_type) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/thumblemonks/indico/text_extractor.rb', line 10

def self.type_known?(mime_type)
  known_types.has_key?(mime_type)
end