Sha256: 42fc443864bef4d5fa7b86b4059ae5681c3525e7418587eb296442e79159a3a8

Contents?: true

Size: 963 Bytes

Versions: 1

Compression:

Stored size: 963 Bytes

Contents

require 'pathname'

module Natour
  module_function

  def create_reports(dir, out_dir: nil, out_file: nil, overwrite: false,
                     track_formats: %i[gpx fit], create_map: true, map_layers: [],
                     adoc_author: nil, short_species_names: false)
    out_dir = Pathname(out_dir || dir)
    out_file = Pathname(out_file || "#{Pathname(dir).realpath.basename}.adoc")
    reports = Report.load_directory(
      dir, track_formats: track_formats, create_map: create_map, overwrite_map: overwrite, map_layers: map_layers
    )
    reports.map.with_index(1) do |report, index|
      filename = if index < 2
                   out_dir.join(out_file)
                 else
                   out_dir.join("#{out_file.basename('.*')} (#{index})#{out_file.extname}")
                 end
      report.save_adoc(filename, overwrite: overwrite, author: adoc_author, short_species_names: short_species_names)
      filename.to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
natour-0.12.0 lib/natour/create_reports.rb