Skip to content

Instantly share code, notes, and snippets.

@rochefort
Last active July 22, 2017 14:41
Show Gist options
  • Save rochefort/ddb3e3996e1777f7b2c8a91d8fa632a1 to your computer and use it in GitHub Desktop.
Save rochefort/ddb3e3996e1777f7b2c8a91d8fa632a1 to your computer and use it in GitHub Desktop.
git-trend json example
require 'git-trend'
repos = GitTrend.get
json = repos.map { |repo| repo.to_h }.to_json
puts json
require 'git-trend'
require 'json'
def to_h(repo)
{
name: repo.name,
description: repo.description,
lang: repo.lang,
all_star_count: repo.all_star_count,
fork_count: repo.fork_count,
star_count: repo.star_count,
}
end
repos = GitTrend.get
json = repos.map { |repo| to_h(repo) }.to_json
puts json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment