Sha256: 28f050649623383edf39100933bd963407b22e3a4f90faae80fe637e9b9c60de

Contents?: true

Size: 971 Bytes

Versions: 5

Compression:

Stored size: 971 Bytes

Contents

module Reek
  module Cli
    module Report
      module HeadingFormatter
        #
        # Base class for heading formatters.
        # Is responsible for formatting the heading emitted for each examiner
        #
        class Base
          attr_reader :report_formatter

          def initialize(report_formatter)
            @report_formatter = report_formatter
          end

          def header(examiner)
            if show_header?(examiner)
              report_formatter.header examiner
            else
              ''
            end
          end
        end

        #
        # Lists out each examiner, even if it has no smell
        #
        class Verbose < Base
          def show_header?(_examiner)
            true
          end
        end

        #
        # Lists only smelly examiners
        #
        class Quiet < Base
          def show_header?(examiner)
            examiner.smelly?
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reek-2.0.4 lib/reek/cli/report/heading_formatter.rb
reek-2.0.3 lib/reek/cli/report/heading_formatter.rb
reek-2.0.2 lib/reek/cli/report/heading_formatter.rb
reek-2.0.1 lib/reek/cli/report/heading_formatter.rb
reek-2.0.0 lib/reek/cli/report/heading_formatter.rb