lib/nanoc/helpers/xml_sitemap.rb in nanoc-3.7.4 vs lib/nanoc/helpers/xml_sitemap.rb in nanoc-3.7.5

- old
+ new

@@ -1,14 +1,12 @@ # encoding: utf-8 module Nanoc::Helpers - # Contains functionality for building XML sitemaps that will be crawled by # search engines. See the [Sitemaps protocol site](http://www.sitemaps.org) # for details. module XMLSitemap - # Builds an XML sitemap and returns it. # # The following attributes can optionally be set on items to change the # behaviour of the sitemap: # @@ -46,22 +44,22 @@ items = params.fetch(:items) { @items.reject { |i| i[:is_hidden] } } select_proc = params.fetch(:rep_select, nil) # Create builder buffer = '' - xml = Builder::XmlMarkup.new(:target => buffer, :indent => 2) + xml = Builder::XmlMarkup.new(target: buffer, indent: 2) # Check for required attributes if @site.config[:base_url].nil? raise RuntimeError.new('The Nanoc::Helpers::XMLSitemap helper requires the site configuration to specify the base URL for the site.') end # Build sitemap xml.instruct! - xml.urlset(:xmlns => 'http://www.sitemaps.org/schemas/sitemap/0.9') do + xml.urlset(xmlns: 'http://www.sitemaps.org/schemas/sitemap/0.9') do # Add item - items.sort_by { |i| i.identifier }.each do |item| + items.sort_by(&:identifier).each do |item| reps = item.reps.reject { |r| r.raw_path.nil? } reps.reject! { |r| !select_proc[r] } if select_proc reps.sort_by { |r| r.name.to_s }.each do |rep| xml.url do xml.loc @site.config[:base_url] + rep.path @@ -74,9 +72,7 @@ end # Return sitemap buffer end - end - end