Last active
July 22, 2017 14:41
-
-
Save rochefort/ddb3e3996e1777f7b2c8a91d8fa632a1 to your computer and use it in GitHub Desktop.
git-trend json example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'git-trend' | |
repos = GitTrend.get | |
json = repos.map { |repo| repo.to_h }.to_json | |
puts json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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