lib/big_sitemap.rb in alexrabarts-big_sitemap-0.2.0 vs lib/big_sitemap.rb in alexrabarts-big_sitemap-0.2.1

- old
+ new

@@ -19,11 +19,11 @@ raise ArgumentError, 'Document root must be specified with the :document_root option' if document_root.nil? @base_url = options.delete(:base_url) @max_per_sitemap = options.delete(:max_per_sitemap) || 50000 @batch_size = options.delete(:batch_size) || 1001 # TODO: Set this to 1000 once DM offset 37000 bug is fixed - @web_path = options.delete(:path) || 'sitemaps' + @web_path = strip_leading_slash(options.delete(:path) || 'sitemaps') @ping_google = options[:ping_google].nil? ? true : options.delete(:ping_google) @ping_yahoo = options[:ping_yahoo].nil? ? true : options.delete(:ping_yahoo) @yahoo_app_id = options.delete(:yahoo_app_id) @ping_msn = options[:ping_msn].nil? ? true : options.delete(:ping_msn) @ping_ask = options[:ping_ask].nil? ? true : options.delete(:ping_ask) @@ -40,11 +40,11 @@ Dir.mkdir(@file_path) unless File.exists? @file_path end def add(options) raise ArgumentError, ':model and :path options must be provided' unless options[:model] && options[:path] - @sources << options + @sources << options.update(:path => strip_leading_slash(options[:path])) self # Chainable end def clean unless @file_path.nil? @@ -125,9 +125,13 @@ ping_search_engines self # Chainable end private + def strip_leading_slash(str) + str.sub(/^\//, '') + end + def pick_method(klass, candidates) method = nil candidates.each do |candidate| if klass.respond_to? candidate method = candidate \ No newline at end of file