Permalink
Browse files

Cosmetic refatoring

  • Loading branch information...
1 parent b01d800 commit 6dff0de5e447ebe3f18a8835891e45febb5d70e0 @alexrabarts alexrabarts committed Mar 10, 2009
Showing with 4 additions and 8 deletions.
  1. +4 −8 lib/big_sitemap.rb
View
@@ -6,7 +6,7 @@
class BigSitemap
def initialize(options)
- document_root = options.delete(:document_root)
+ document_root = options.delete(:document_root)
if document_root.nil?
if defined? RAILS_ROOT
@@ -37,9 +37,7 @@ def initialize(options)
'Batch size (:batch_size) must be less than or equal to maximum URLs per sitemap (:max_per_sitemap)'
) if @batch_size > @max_per_sitemap
- unless File.exists? @file_path
- Dir.mkdir(@file_path)
- end
+ Dir.mkdir(@file_path) unless File.exists? @file_path
end
def add(options)
@@ -101,11 +99,9 @@ def generate
param_method = pick_method(r, [:to_param, :id])
raise ArgumentError, "#{klass} must provide a to_param instance method" if param_method.nil?
- path = {:url => "#{source[:path]}/#{r.send(param_method)}", :last_mod => last_mod}
-
xml.url do
- xml.loc("#{@base_url}/#{path[:url]}")
- xml.lastmod(path[:last_mod].strftime('%Y-%m-%d')) unless path[:last_mod].nil?
+ xml.loc("#{@base_url}/#{source[:path]}/#{r.send(param_method)}")
+ xml.lastmod(last_mod.strftime('%Y-%m-%d')) unless last_mod.nil?
xml.changefreq('weekly')
end
end

0 comments on commit 6dff0de

Please sign in to comment.