Skip to content

Commit d9c695f

Browse files
committed
cache client
1 parent 32857aa commit d9c695f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/jekyll-gist/gist_tag.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def fetch_raw_code(gist_id, filename = nil)
9090
private
9191

9292
def code_from_api(gist_id, filename = nil)
93-
client = Octokit::Client.new :access_token => ENV["JEKYLL_GITHUB_TOKEN"]
9493
gist = client.gist gist_id
9594

9695
file = if filename.to_s.empty?
@@ -106,6 +105,10 @@ def code_from_api(gist_id, filename = nil)
106105

107106
file[:content] if file
108107
end
108+
109+
def client
110+
@client ||= Octokit::Client.new :access_token => ENV["JEKYLL_GITHUB_TOKEN"]
111+
end
109112
end
110113
end
111114
end

0 commit comments

Comments
 (0)