Class: SitemapGenerator::SitemapIndexLocation

Inherits:
SitemapLocation show all
Defined in:
lib/sitemap_generator/sitemap_location.rb

Constant Summary

Constant Summary

Constants inherited from SitemapLocation

SitemapGenerator::SitemapLocation::PATH_OUTPUT_WIDTH

Constants included from Helpers::NumberHelper

Helpers::NumberHelper::DECIMAL_UNITS, Helpers::NumberHelper::STORAGE_UNITS

Instance Method Summary collapse

Methods inherited from SitemapLocation

#[]=, #directory, #filename, #filesize, #namer, #path, #path_in_public, #reserve_name, #reserved_name?, #url, #verbose?, #with, #write

Methods included from Helpers::NumberHelper

#number_to_human_size, #number_with_delimiter, #number_with_precision

Constructor Details

#initialize(opts = {}) ⇒ SitemapIndexLocation

Returns a new instance of SitemapIndexLocation



168
169
170
171
172
173
# File 'lib/sitemap_generator/sitemap_location.rb', line 168

def initialize(opts={})
  if !opts[:filename] && !opts[:namer]
    opts[:namer] = SitemapGenerator::SimpleNamer.new(:sitemap)
  end
  super(opts)
end

Instance Method Details

#create_indexObject

Whether to create a sitemap index. Default `:auto`. See LinkSet::create_index= for possible values.

A placeholder for an option which should really go into some kind of options class.



180
181
182
# File 'lib/sitemap_generator/sitemap_location.rb', line 180

def create_index
  self[:create_index]
end

#summary(link_count) ⇒ Object

Return a summary string



185
186
187
188
189
190
# File 'lib/sitemap_generator/sitemap_location.rb', line 185

def summary(link_count)
  filesize = number_to_human_size(self.filesize)
  width = self.class::PATH_OUTPUT_WIDTH - 3
  path = SitemapGenerator::Utilities.ellipsis(self.path_in_public, width)
  "+ #{('%-'+width.to_s+'s') % path} #{'%10s' % link_count} sitemaps / #{'%10s' % filesize}"
end