Class: Diffy::SplitDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/diffy/split_diff.rb

Instance Method Summary collapse

Constructor Details

#initialize(left, right, options = {}) ⇒ SplitDiff

Returns a new instance of SplitDiff.



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/diffy/split_diff.rb', line 3

def initialize(left, right, options = {})
  @format = options[:format] || Diffy::Diff.default_format

  formats = Format.instance_methods(false).map { |x| x.to_s }
  unless formats.include?(@format.to_s)
    fail ArgumentError, "Format #{format.inspect} is not a valid format"
  end

  @diff = Diffy::Diff.new(left, right, options).to_s(@format)
  @left_diff, @right_diff = split
end