Class: ProjectHealth::Project
- Inherits:
-
Object
- Object
- ProjectHealth::Project
- Includes:
- ActiveSupport::Configurable
- Defined in:
- lib/project-health/config.rb,
lib/project-health/project.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add_report(report) ⇒ Object
-
#initialize(name) ⇒ Project
constructor
A new instance of Project.
- #stats ⇒ Object
Constructor Details
#initialize(name) ⇒ Project
Returns a new instance of Project.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/project-health/project.rb', line 6 def initialize(name) @oct = Octokit::Client.new(auto_traversal: true, per_page: 500, login: config.login, password: config.password) @name = name @reports = [] add_report :basic add_report :pull_requests add_report :issues end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/project-health/project.rb', line 4 def name @name end |
Instance Method Details
#add_report(report) ⇒ Object
17 18 19 |
# File 'lib/project-health/project.rb', line 17 def add_report(report) @reports << ProjectHealth.const_get("#{report}_report".to_s.camelize).new(@oct, name) end |
#stats ⇒ Object
21 22 23 24 25 |
# File 'lib/project-health/project.rb', line 21 def stats result = {} @reports.map{|x| result.merge!(x.stats) } { "Project" => result } end |