class Rack::RackSeo::Dispatcher

Attributes

description_selector[RW]
keywords_selector[RW]
title_format[RW]

Public Class Methods

new(config, current_path) click to toggle source
# File lib/rack-seo/dispatcher.rb, line 6
def initialize(config, current_path)
  if config["custom"]
    matching_path = config["custom"].detect do |custom_path|
      (custom_path["matcher"].is_a?(String) && current_path.include?(custom_path["matcher"])) or
      (custom_path["matcher"].is_a?(Regexp) && current_path =~ custom_path["matcher"])
    end
  end
  matching_path ||= {}
  @title_format = matching_path["title_format"] || config["default"]["title_format"]
  @description_selector = matching_path["meta_description_selector"] || config["default"]["meta_description_selector"]
  @keywords_selector = matching_path["meta_keywords_selector"] || config["default"]["meta_keywords_selector"]
end