Skip to content

Commit c8340e6

Browse files
committed
Cache items for the lifecycle of the data source.
That is expected to match single nanoc run.
1 parent a0ffaa3 commit c8340e6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/nanoc/github.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ class Source < Nanoc::DataSource
1010
identifier :github
1111

1212
def items
13-
repository_items.map do |item|
14-
identifier = Nanoc::Identifier.new("/#{item[:name]}")
15-
metadata, data = decode(item[:content])
13+
@items ||= begin
14+
repository_items.map do |item|
15+
identifier = Nanoc::Identifier.new("/#{item[:name]}")
16+
metadata, data = decode(item[:content])
1617

17-
new_item(data, metadata, identifier)
18+
new_item(data, metadata, identifier)
19+
end
1820
end
1921
end
2022

0 commit comments

Comments
 (0)