Sha256: 2ec24a96524562cfd4b97171c5a25effefa8e7b5f02a0b9bd739b16b5c5ff03d
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true module RailsAppGenerator module Diff # Diff Report class OpenInEditor attr_reader :info attr_reader :open_left_only attr_reader :open_right_only attr_reader :open_same attr_reader :open_different 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? ? true : 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 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 private def open_files(files) files.map do |f| system("code --diff #{f.lhs_absolute_file} #{f.rhs_absolute_file}") end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_app_generator-0.0.12 | lib/rails_app_generator/diff/open_in_editor.rb |