Class: Indexmap::Creator
- Inherits:
-
Object
- Object
- Indexmap::Creator
- Defined in:
- lib/indexmap/creator.rb
Defined Under Namespace
Classes: ValidationConfiguration
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(output:) ⇒ Creator
constructor
A new instance of Creator.
Constructor Details
#initialize(output:) ⇒ Creator
Returns a new instance of Creator.
10 11 12 |
# File 'lib/indexmap/creator.rb', line 10 def initialize(output:) @output = output end |
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/indexmap/creator.rb', line 14 def create FileUtils.mkdir_p(output.public_path.dirname) Dir.mktmpdir("indexmap", output.public_path.dirname) do |dir| staging_path = Pathname(dir) written_files = write_to(staging_path) sitemap_files = sitemap_files_in(staging_path) format(sitemap_files) validate(staging_path.join(output.index_filename)) publish(sitemap_files) written_files.map { |path| output.public_path.join(path.basename) } end end |