Class: Watchr::FlogReportClass
- Inherits:
-
Object
- Object
- Watchr::FlogReportClass
- Defined in:
- lib/watchr/metrics/flog/class.rb
Overview
Flog report class information.
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#methods ⇒ Object
readonly
Returns the value of attribute methods.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#total_score ⇒ Object
readonly
Returns the value of attribute total_score.
Instance Method Summary collapse
- #add_method(method_report) ⇒ Object
-
#initialize(name, score) ⇒ FlogReportClass
constructor
A new instance of FlogReportClass.
- #total_methods_score ⇒ Object
Constructor Details
#initialize(name, score) ⇒ FlogReportClass
Returns a new instance of FlogReportClass.
8 9 10 11 12 |
# File 'lib/watchr/metrics/flog/class.rb', line 8 def initialize(name, score) @name = name @total_score = (10 * score).round / 10.0 @methods = [] end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
6 7 8 |
# File 'lib/watchr/metrics/flog/class.rb', line 6 def location @location end |
#methods ⇒ Object (readonly)
Returns the value of attribute methods.
6 7 8 |
# File 'lib/watchr/metrics/flog/class.rb', line 6 def methods @methods end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/watchr/metrics/flog/class.rb', line 6 def name @name end |
#total_score ⇒ Object (readonly)
Returns the value of attribute total_score.
6 7 8 |
# File 'lib/watchr/metrics/flog/class.rb', line 6 def total_score @total_score end |
Instance Method Details
#add_method(method_report) ⇒ Object
22 23 24 25 |
# File 'lib/watchr/metrics/flog/class.rb', line 22 def add_method(method_report) @methods << method_report @location = Location.new(method_report.location.file) end |
#total_methods_score ⇒ Object
18 19 20 |
# File 'lib/watchr/metrics/flog/class.rb', line 18 def total_methods_score @methods.reduce(0) {|sum, method| sum += method.total_score} end |