Class: RailsAppGenerator::Diff::OpenInEditor

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

Overview

Diff Report

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compare_info, **opts) ⇒ OpenInEditor

Returns a new instance of OpenInEditor.



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

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

  @open_left_only   = opts[:open_left_only].nil?  ? false : opts[:open_left_only]
  @open_right_only  = opts[:open_right_only].nil? ? false : opts[:open_right_only]
  @open_same        = opts[:open_same].nil?       ? false : opts[:open_same]
  @open_different   = opts[:open_different].nil?  ? true  : opts[:open_different]
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



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

def info
  @info
end

#open_differentObject (readonly)

Returns the value of attribute open_different.



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

def open_different
  @open_different
end

#open_left_onlyObject (readonly)

Returns the value of attribute open_left_only.



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

def open_left_only
  @open_left_only
end

#open_right_onlyObject (readonly)

Returns the value of attribute open_right_only.



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

def open_right_only
  @open_right_only
end

#open_sameObject (readonly)

Returns the value of attribute open_same.



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

def open_same
  @open_same
end

Instance Method Details

#openObject



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

def open
  open_files(info.lhs_only)   if open_left_only
  open_files(info.rhs_only)   if open_right_only
  open_files(info.same)       if open_same
  open_files(info.diff)       if open_different
end