Module: ChupaText::Decomposers

Defined in:
lib/chupa-text/decomposers.rb,
lib/chupa-text/decomposers/csv.rb,
lib/chupa-text/decomposers/tar.rb,
lib/chupa-text/decomposers/xml.rb,
lib/chupa-text/decomposers/zip.rb,
lib/chupa-text/decomposers/gzip.rb,
lib/chupa-text/decomposers/http-server.rb,
lib/chupa-text/decomposers/opendocument.rb,
lib/chupa-text/decomposers/office-open-xml.rb,
lib/chupa-text/decomposers/opendocument-text.rb,
lib/chupa-text/decomposers/office-open-xml-document.rb,
lib/chupa-text/decomposers/office-open-xml-workbook.rb,
lib/chupa-text/decomposers/opendocument-spreadsheet.rb,
lib/chupa-text/decomposers/opendocument-presentation.rb,
lib/chupa-text/decomposers/office-open-xml-presentation.rb

Defined Under Namespace

Classes: CSV, Gzip, HTTPServer, OfficeOpenXML, OfficeOpenXMLDocument, OfficeOpenXMLPresentation, OfficeOpenXMLWorkbook, OpenDocument, OpenDocumentPresentation, OpenDocumentSpreadsheet, OpenDocumentText, Tar, XML, Zip

Class Method Summary collapse

Class Method Details

.create(registry, configuration) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/chupa-text/decomposers.rb', line 49

def create(registry, configuration)
  enabled_names = resolve_names(registry, configuration.names)
  enabled_names.collect do |enabled_name|
    decomposer_class = registry.find(enabled_name)
    options = configuration.options[name] || {}
    decomposer_class.new(options)
  end
end

.enable_all_gemsObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/chupa-text/decomposers.rb', line 20

def enable_all_gems
  decomposer_specs = Gem::Specification.find_all do |spec|
    spec.name.start_with?("chupa-text-decomposer-")
  end
  grouped_decomposer_specs = decomposer_specs.group_by(&:name)
  latest_decomposer_specs = []
  grouped_decomposer_specs.each do |name, specs|
    latest_decomposer_specs << specs.sort_by(&:version).last
  end
  latest_decomposer_specs.each do |spec|
    gem(spec.name, spec.version)
  end
end

.loadObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/chupa-text/decomposers.rb', line 34

def load
  paths = []
  $LOAD_PATH.each do |load_path|
    next unless File.directory?(load_path)
    Dir.chdir(load_path) do
      Dir.glob("chupa-text/decomposers/*.rb") do |decomposer_path|
        paths << decomposer_path.gsub(/\.rb\z/, "")
      end
    end
  end
  paths.each do |path|
    require path
  end
end