Class: Jekyll::GithubCard::GithubRepoTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::GithubCard::GithubRepoTag
- Defined in:
- lib/jekyll-github-card/tag.rb
Constant Summary collapse
- GITHUB_API_URL =
"https://api.github.com/repos"- CACHE =
{}
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ GithubRepoTag
constructor
A new instance of GithubRepoTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ GithubRepoTag
Returns a new instance of GithubRepoTag.
14 15 16 17 |
# File 'lib/jekyll-github-card/tag.rb', line 14 def initialize(tag_name, markup, tokens) super @repo = markup.strip end |
Instance Method Details
#render(context) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/jekyll-github-card/tag.rb', line 19 def render(context) return error_card("No repository specified") if @repo.empty? repo_data = fetch_repo_data(@repo) return error_card(repo_data[:error]) if repo_data[:error] build_card(repo_data) end |