Sha256: d3e9aafefe7222c24f74f53fdaf0eba07ef8e3f592322d9b4bd925c0c9ad8068
Contents?: true
Size: 1.27 KB
Versions: 35
Compression:
Stored size: 1.27 KB
Contents
# require "eitil_integrate/application_exporter/lookups" require "eitil_integrate/application_exporter/initialize" require "eitil_support/directory" module EitilIntegrate::RubyXL class ApplicationExporter class << self def exporter_paths EitilSupport::Directory.files('app/exporters/exporters').select { |path| path.end_with? '_exporter.rb' } end def exporter_names exporter_paths.map { |path| path.split('/').last.remove('.rb').camelcase } end def exporter_constants exporter_names.map &:constantize end def exporter_infos exporter_constants.map { |_c| { "#{_c.to_s.remove("Exporter")}": _c.info || {} } }.inject &:merge end def exporter_info(exporter, info) exporter_infos[exporter]&.dig(info) end # returns the exporter_infos, without the datatypes – for taxonomy purpuses, the field # names are often sufficient def exporter_taxonomy exporter_infos.transform_values do |settings| settings.transform_values { |info| info.first.is_a?(Hash) ? info.first.keys : info } end end def exporter_params exporter_infos.transform_values { |v| [v[:required], v[:optional]].flatten.compact } end end end end
Version data entries
35 entries across 35 versions & 1 rubygems