Class: GithubScouter::Printer
- Inherits:
-
Object
- Object
- GithubScouter::Printer
- Defined in:
- lib/github_scouter.rb
Instance Method Summary collapse
-
#initialize(scouter) ⇒ Printer
constructor
A new instance of Printer.
- #power ⇒ Object
- #put ⇒ Object
- #rank(repos, label) ⇒ Object
- #repos_rank ⇒ Object
- #starred_rank ⇒ Object
Constructor Details
#initialize(scouter) ⇒ Printer
Returns a new instance of Printer.
86 87 88 |
# File 'lib/github_scouter.rb', line 86 def initialize(scouter) @scouter = scouter end |
Instance Method Details
#power ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'lib/github_scouter.rb', line 98 def power atk = @scouter.atk int = @scouter.int agi = @scouter.agi params = [atk,int,agi] puts "戦闘力: %d" % params.sum puts puts "攻撃力: %d 知力: %d すばやさ: %d" % params end |
#put ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/github_scouter.rb', line 90 def put power puts "" repos_rank puts "" starred_rank end |
#rank(repos, label) ⇒ Object
116 117 118 119 120 121 122 123 |
# File 'lib/github_scouter.rb', line 116 def rank(repos,label) rank = Scouter.language_rank(repos) puts "# #{label} (#{repos.count})" puts "" rank[0..9].each_with_index do |(key,value),i| puts "#{i+1}. ".ljust(4) + key.ljust(20) + value.to_s end end |
#repos_rank ⇒ Object
108 109 110 |
# File 'lib/github_scouter.rb', line 108 def repos_rank rank(@scouter.repos, "repositories") end |
#starred_rank ⇒ Object
112 113 114 |
# File 'lib/github_scouter.rb', line 112 def starred_rank rank(@scouter.starred, "starred") end |