Cache name matching regex
This commit is contained in:
parent
eaa132c65b
commit
d4c15efff9
|
@ -9,10 +9,12 @@ module Jekyll
|
||||||
@name = name
|
@name = name
|
||||||
all, @path, @date, @slug = *name.sub(/^\//, "").match(MATCHER)
|
all, @path, @date, @slug = *name.sub(/^\//, "").match(MATCHER)
|
||||||
raise ArgumentError.new("'#{name}' does not contain valid date and/or title.") unless all
|
raise ArgumentError.new("'#{name}' does not contain valid date and/or title.") unless all
|
||||||
|
|
||||||
|
@name_regex = /^#{path}#{date}-#{slug}\.[^.]+/
|
||||||
end
|
end
|
||||||
|
|
||||||
def ==(other)
|
def ==(other)
|
||||||
other.name.match(/^#{path}#{date}-#{slug}\.[^.]+/)
|
other.name.match(@name_regex)
|
||||||
end
|
end
|
||||||
|
|
||||||
def deprecated_equality(other)
|
def deprecated_equality(other)
|
||||||
|
|
Loading…
Reference in New Issue