class SiteHub::LocationRewriters

Constants

DEFAULT

Public Class Methods

new(map = {}) click to toggle source
Calls superclass method
# File lib/sitehub/location_rewriters.rb, line 7
def initialize(map = {})
  enriched = map.collect do |pattern, path_template|
    matcher = pattern.is_a?(Regexp) ? pattern : /#{pattern}/
    LocationRewriter.new(matcher, path_template)
  end

  super enriched
end

Public Instance Methods

find(url) click to toggle source
Calls superclass method
# File lib/sitehub/location_rewriters.rb, line 16
def find(url)
  result = super() do |directive|
    directive.match?(url)
  end
  result || DEFAULT
end