Checking the identifier before the attributes makes nanoc faster.

This commit is contained in:
Chris Eppstein 2010-02-07 09:37:07 -08:00
parent f9a66671f8
commit 132a80dddd

View File

@ -33,8 +33,9 @@ def reference_item(options)
path = stylesheet_path(stylesheet)
if path
@items.detect do |i|
i[:stylesheet] == path &&
i.identifier =~ /^\/reference/
i.identifier =~ /^\/reference/ &&
i[:stylesheet] == path
end
end
end
@ -136,7 +137,9 @@ end
def example_items
@site.cached("examples") do
@items.select{|i| i[:example]}
@items.select do |i|
i.identifier =~ /^\/examples/ && i[:example]
end
end
end