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.2.30 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.29 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.28 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.27 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.26 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.25 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.24 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.23 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.22 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.21 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.20 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.19 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.18 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.17 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.16 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.15 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.14 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.13 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.12 lib/rails_app_generator/diff/report.rb
rails_app_generator-0.2.11 lib/rails_app_generator/diff/report.rb