Class: GitHubRecordsArchiver::Repository
- Inherits:
-
GitRepository
- Object
- GitRepository
- GitHubRecordsArchiver::Repository
- Includes:
- DataHelper
- Defined in:
- lib/github_records_archiver/repository.rb
Constant Summary collapse
- KEYS =
%i[ name full_name description private fork homepage forks_count stargazers_count watchers_count size ].freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(name_or_hash) ⇒ Repository
constructor
A new instance of Repository.
- #issues ⇒ Object
- #issues_dir ⇒ Object
- #wiki ⇒ Object
Methods included from DataHelper
#method_missing, #respond_to_missing?, #to_h, #to_json
Methods inherited from GitRepository
Constructor Details
#initialize(name_or_hash) ⇒ Repository
Returns a new instance of Repository.
11 12 13 14 15 16 17 18 |
# File 'lib/github_records_archiver/repository.rb', line 11 def initialize(name_or_hash) if name_or_hash.is_a?(String) @name = name_or_hash else @data = name_or_hash.to_h @name = @data[:full_name] end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class GitHubRecordsArchiver::DataHelper
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/github_records_archiver/repository.rb', line 3 def name @name end |
Instance Method Details
#data ⇒ Object
20 21 22 |
# File 'lib/github_records_archiver/repository.rb', line 20 def data @data ||= GitHubRecordsArchiver.client.repository(name) end |
#issues ⇒ Object
28 29 30 31 32 33 |
# File 'lib/github_records_archiver/repository.rb', line 28 def issues @issues ||= begin issues = GitHubRecordsArchiver.client.list_issues name, state: 'all' issues.map { |i| Issue.from_hash(self, i) } end end |
#issues_dir ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/github_records_archiver/repository.rb', line 35 def issues_dir @issues_dir ||= begin dir = File. 'issues', repo_dir FileUtils.mkdir_p(dir) unless Dir.exist?(dir) dir end end |