fix Middleman::Util.path_match to work with string matchers

This commit is contained in:
Avia Aharon 2012-12-18 12:32:13 +02:00
parent 6e44851069
commit b084982923

View file

@ -90,7 +90,9 @@ module Middleman
# @param path A path as a string # @param path A path as a string
# @return [Boolean] Whether the path matches the matcher # @return [Boolean] Whether the path matches the matcher
def self.path_match(matcher, path) def self.path_match(matcher, path)
if matcher.respond_to? :match if matcher.is_a? String
path.match matcher
elsif matcher.respond_to? :match
matcher.match path matcher.match path
elsif matcher.respond_to? :call elsif matcher.respond_to? :call
matcher.call path matcher.call path