Created
March 19, 2010 19:27
-
-
Save norman/338082 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sitemap | |
attr_accessor :entries | |
def add(array, &block) | |
array.map do |a| | |
if entry = block(a) | |
@entries << entry | |
end | |
end | |
end | |
end | |
sm = Sitemap.new | |
sm.add(paths) do |path| | |
if url =~ /my_public_stuff/ | |
Entry.new(:path => path, :priority => 0.7, :frequency => "monthly") | |
elsif url =~ /my_private_stuff/ | |
# don't include in sitemap | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment