Class: Rubycrap::Reporter
- Inherits:
-
Object
- Object
- Rubycrap::Reporter
- Defined in:
- lib/rubycrap/reporter.rb
Instance Attribute Summary collapse
-
#crap_methods ⇒ Object
readonly
Returns the value of attribute crap_methods.
-
#crap_methods_by_score ⇒ Object
readonly
Returns the value of attribute crap_methods_by_score.
Instance Method Summary collapse
- #console ⇒ Object
- #html ⇒ Object
-
#initialize(crap_methods) ⇒ Reporter
constructor
A new instance of Reporter.
Constructor Details
#initialize(crap_methods) ⇒ Reporter
Returns a new instance of Reporter.
6 7 8 9 |
# File 'lib/rubycrap/reporter.rb', line 6 def initialize(crap_methods) @crap_methods = crap_methods @crap_methods_by_score = crap_methods.sort_by { |k| -k[:crap_score] } end |
Instance Attribute Details
#crap_methods ⇒ Object (readonly)
Returns the value of attribute crap_methods.
4 5 6 |
# File 'lib/rubycrap/reporter.rb', line 4 def crap_methods @crap_methods end |
#crap_methods_by_score ⇒ Object (readonly)
Returns the value of attribute crap_methods_by_score.
4 5 6 |
# File 'lib/rubycrap/reporter.rb', line 4 def crap_methods_by_score @crap_methods_by_score end |
Instance Method Details
#console ⇒ Object
15 16 17 18 19 |
# File 'lib/rubycrap/reporter.rb', line 15 def console crap_methods_by_score[0..10].each do |element| puts formated_result(element) end end |
#html ⇒ Object
11 12 13 |
# File 'lib/rubycrap/reporter.rb', line 11 def html File.open("CRAP.html", 'w') { |file| file.write(build_html) } end |