Class: Rack::RackSeo::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rack-seo/dispatcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, current_path) ⇒ Dispatcher

Returns a new instance of Dispatcher.



6
7
8
9
10
11
12
13
14
15
16
17
# 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

Instance Attribute Details

#description_selectorObject

Returns the value of attribute description_selector.



3
4
5
# File 'lib/rack-seo/dispatcher.rb', line 3

def description_selector
  @description_selector
end

#keywords_selectorObject

Returns the value of attribute keywords_selector.



4
5
6
# File 'lib/rack-seo/dispatcher.rb', line 4

def keywords_selector
  @keywords_selector
end

#title_formatObject

Returns the value of attribute title_format.



2
3
4
# File 'lib/rack-seo/dispatcher.rb', line 2

def title_format
  @title_format
end