Sha256: 6147a99796b294bf21176ef0fc2c2cbd33e4b1c29cac2e9c33b2cf258ab0d19b

Contents?: true

Size: 1.21 KB

Versions: 79

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module RailsAppGenerator
  module Diff
    # Diff Report
    class Report
      attr_reader :info

      attr_reader :show_left_only
      attr_reader :show_right_only
      attr_reader :show_same
      attr_reader :show_different

      def initialize(compare_info, **opts)
        @info = compare_info

        @show_left_only   = opts[:show_left_only].nil?    ? true  : opts[:show_left_only]
        @show_right_only  = opts[:show_right_only].nil?   ? true  : opts[:show_right_only]
        @show_same        = opts[:show_same].nil?         ? false : opts[:show_same]
        @show_different   = opts[:show_different].nil?    ? true  : opts[:show_different]
      end

      def display
        display_files('Files only in source folder' , info.lhs_only) if show_left_only
        display_files('Files only in target folder' , info.rhs_only) if show_right_only
        display_files('Files in both folders'       , info.same) if show_same
        display_files('Files that are different'    , info.diff) if show_different
      end

      private

      def display_files(heading, files)
        return if files.empty?

        Util.line(heading)
        puts files.map(&:file)
      end
    end
  end
end

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.3.5 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.3.4 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.3.3 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.3.2 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.3.1 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.3.0 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.43 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.42 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.41 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.40 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.39 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.38 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.37 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.36 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.35 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.34 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.33 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.32 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.31 lib/rails_app_generator/diff/report.rb