class Multidiff::Runner

Public Class Methods

invoke(args) click to toggle source
# File lib/multidiff/runner.rb, line 3
def self.invoke(args)
  data = read_files(args)

  abort 'Nothing to compare' if data.count < 2

  puts Multidiff::Differ.pretty_diff(data).map { |diff| diff.join("\n") }.join("\n\n")
end

Private Class Methods

read_files(paths) click to toggle source
# File lib/multidiff/runner.rb, line 14
def read_files(paths)
  paths.each_with_object([]) do |path, memo|
    pathname = Pathname.new(path)

    memo << pathname.read.split("\n") if pathname.file?
  end
end