Module: Sitemapper::Adapters::RailsAdapter::RoutesMapperExtension

Defined in:
lib/sitemapper/adapters/rails_adapter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/sitemapper/adapters/rails_adapter.rb', line 5

def self.included(base)
  base.class_eval do
    alias_method_chain :named_route, :sitemap
    alias_method_chain :connect, :sitemap
    alias_method_chain :root, :sitemap
  end
  path = File.join(Rails.root, 'public', 'sitemap_static.xml.gz')
  File.unlink(path) if File.exists?(path)
  @@map = Sitemapper::map_index.build_map(path)
end

Instance Method Details

#connect_with_sitemap(path, options = {}) ⇒ Object



21
22
23
24
# File 'lib/sitemapper/adapters/rails_adapter.rb', line 21

def connect_with_sitemap(path, options = {})
  map_if_possible(path, options)
  connect_without_sitemap(path, options)
end

#named_route_with_sitemap(name, path, options = {}) ⇒ Object



16
17
18
19
# File 'lib/sitemapper/adapters/rails_adapter.rb', line 16

def named_route_with_sitemap(name, path, options = {})
  map_if_possible(path, options)
  named_route_without_sitemap(name, path, options)
end

#root_with_sitemap(options = {}) ⇒ Object



26
27
28
29
# File 'lib/sitemapper/adapters/rails_adapter.rb', line 26

def root_with_sitemap(options = {})
  map_if_possible('/', options)
  root_without_sitemap(options)
end