Class: RailsAppGenerator::Diff::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_app_generator/diff/report.rb

Overview

Diff Report

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compare_info, **opts) ⇒ Report

Returns a new instance of Report.



14
15
16
17
18
19
20
21
# File 'lib/rails_app_generator/diff/report.rb', line 14

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

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



7
8
9
# File 'lib/rails_app_generator/diff/report.rb', line 7

def info
  @info
end

#show_differentObject (readonly)

Returns the value of attribute show_different.



12
13
14
# File 'lib/rails_app_generator/diff/report.rb', line 12

def show_different
  @show_different
end

#show_left_onlyObject (readonly)

Returns the value of attribute show_left_only.



9
10
11
# File 'lib/rails_app_generator/diff/report.rb', line 9

def show_left_only
  @show_left_only
end

#show_right_onlyObject (readonly)

Returns the value of attribute show_right_only.



10
11
12
# File 'lib/rails_app_generator/diff/report.rb', line 10

def show_right_only
  @show_right_only
end

#show_sameObject (readonly)

Returns the value of attribute show_same.



11
12
13
# File 'lib/rails_app_generator/diff/report.rb', line 11

def show_same
  @show_same
end

Instance Method Details

#displayObject



23
24
25
26
27
28
# File 'lib/rails_app_generator/diff/report.rb', line 23

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