Class: FavLanguage::Repo
- Inherits:
-
Object
- Object
- FavLanguage::Repo
- Defined in:
- lib/fav_language/repo.rb
Instance Attribute Summary collapse
-
#github ⇒ Object
readonly
Returns the value of attribute github.
Instance Method Summary collapse
-
#initialize(raw, github:) ⇒ Repo
constructor
A new instance of Repo.
- #language_stats ⇒ Object
Constructor Details
#initialize(raw, github:) ⇒ Repo
Returns a new instance of Repo.
7 8 9 10 |
# File 'lib/fav_language/repo.rb', line 7 def initialize(raw, github:) @raw = raw @github = github end |
Instance Attribute Details
#github ⇒ Object (readonly)
Returns the value of attribute github.
5 6 7 |
# File 'lib/fav_language/repo.rb', line 5 def github @github end |
Instance Method Details
#language_stats ⇒ Object
12 13 14 15 16 |
# File 'lib/fav_language/repo.rb', line 12 def language_stats github.get_request(@raw['languages_url']).body.to_h.map do |language, bytes| OpenStruct.new(language: language, bytes: bytes.to_i) end end |