Class: SitemapGenerator::SitemapIndexLocation
- Inherits:
-
SitemapLocation
- Object
- Hash
- SitemapLocation
- SitemapGenerator::SitemapIndexLocation
- Defined in:
- lib/sitemap_generator/sitemap_location.rb
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
-
#create_index ⇒ Object
Whether to create a sitemap index.
-
#initialize(opts = {}) ⇒ SitemapIndexLocation
constructor
A new instance of SitemapIndexLocation.
-
#summary(link_count) ⇒ Object
Return a summary string.
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.
182 183 184 185 186 187 |
# File 'lib/sitemap_generator/sitemap_location.rb', line 182 def initialize(opts={}) if !opts[:filename] && !opts[:namer] opts[:namer] = SitemapGenerator::SimpleNamer.new(:sitemap) end super(opts) end |
Instance Method Details
#create_index ⇒ Object
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.
194 195 196 |
# File 'lib/sitemap_generator/sitemap_location.rb', line 194 def create_index self[:create_index] end |
#summary(link_count) ⇒ Object
Return a summary string
199 200 201 202 203 204 |
# File 'lib/sitemap_generator/sitemap_location.rb', line 199 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 |