Class: SnipSnip::Reporter
- Inherits:
-
Object
- Object
- SnipSnip::Reporter
- Defined in:
- lib/snip_snip/reporter.rb
Overview
Handles outputting unnecessarily selected columns to the logs.
Defined Under Namespace
Classes: Result
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Class Method Summary collapse
-
.report(controller) ⇒ Object
Report on the specified controller.
Instance Method Summary collapse
-
#initialize ⇒ Reporter
constructor
A new instance of Reporter.
-
#report(controller) ⇒ Object
Report on the unused columns that were selected during the course of the processing the action on the given controller.
Constructor Details
#initialize ⇒ Reporter
Returns a new instance of Reporter.
17 18 19 |
# File 'lib/snip_snip/reporter.rb', line 17 def initialize @results = find_results end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
15 16 17 |
# File 'lib/snip_snip/reporter.rb', line 15 def results @results end |
Class Method Details
.report(controller) ⇒ Object
Report on the specified controller.
37 38 39 |
# File 'lib/snip_snip/reporter.rb', line 37 def self.report(controller) new.report(controller) end |
Instance Method Details
#report(controller) ⇒ Object
Report on the unused columns that were selected during the course of the processing the action on the given controller.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/snip_snip/reporter.rb', line 23 def report(controller) return if results.empty? action_display = "#{controller.controller_name}##{controller.action_name}" SnipSnip.logger.info(action_display) results.sort_by(&:report).each do |result| SnipSnip.logger.info(" #{result.report}") end ensure Registry.clear end |