class ActionDispatch::Routing::Mapper

Public Instance Methods

postmarkdown(options = {}) click to toggle source
# File lib/postmarkdown/routes.rb, line 4
def postmarkdown(options = {})
  options.reverse_merge!({ :as => :posts, :permalink_format => :day })

  get "/#{options[:as]}(/:year(/:month(/:day)))" => 'posts#index', :as => :posts, :constraints => { :year => /\d{4}/, :month => /\d{2}/, :day => /\d{2}/}
  get "/#{options[:as]}/feed" => 'posts#feed', :as => :posts_feed, :defaults => {:format => :xml}
  get "/#{options[:as]}/*id" => 'posts#show', :as => :post, :constraints => { :id => postmarkdown_permalink_regex(options) }

  postmarkdown_feed_title(options[:as])
end

Private Instance Methods

postmarkdown_feed_title(path) click to toggle source
# File lib/postmarkdown/routes.rb, line 21
def postmarkdown_feed_title(path)
  Postmarkdown::Config.options[:feed_title] ||= "#{Postmarkdown::Util.app_name} #{path.to_s.tr('/', '_').humanize.titleize}"
end