Class: Metricks::FlogReporter::ScannedMethod
- Inherits:
-
Object
- Object
- Metricks::FlogReporter::ScannedMethod
- Defined in:
- lib/metricks/flog_reporter/scanned_method.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#operators ⇒ Object
Returns the value of attribute operators.
-
#score ⇒ Object
Returns the value of attribute score.
Instance Method Summary collapse
-
#initialize(name, score, operators = []) ⇒ ScannedMethod
constructor
A new instance of ScannedMethod.
- #to_html ⇒ Object
Constructor Details
#initialize(name, score, operators = []) ⇒ ScannedMethod
Returns a new instance of ScannedMethod.
5 6 7 8 9 |
# File 'lib/metricks/flog_reporter/scanned_method.rb', line 5 def initialize(name, score, operators = []) @name = name @score = score.to_f @operators = operators end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/metricks/flog_reporter/scanned_method.rb', line 3 def name @name end |
#operators ⇒ Object
Returns the value of attribute operators.
3 4 5 |
# File 'lib/metricks/flog_reporter/scanned_method.rb', line 3 def operators @operators end |
#score ⇒ Object
Returns the value of attribute score.
3 4 5 |
# File 'lib/metricks/flog_reporter/scanned_method.rb', line 3 def score @score end |
Instance Method Details
#to_html ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/metricks/flog_reporter/scanned_method.rb', line 11 def to_html output = "<p><strong>#{name} (#{score})</strong></p>\n" output << "<table>\n" output << "<tr><th>Score</th><th>Operator</th></tr>\n" count = 0 operators.each do |operator| output << <<-EOF <tr class='#{Base.cycle("light", "dark", count)}'> <td class='score'>#{sprintf(SCORE_FORMAT, operator.score)}</td> <td class='score'>#{operator.operator}</td> </tr> EOF count += 1 end output << "</table>\n\n" end |