Class: Lookout::Diff::Formats::Unified

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/lookout-3.0/diff/formats/unified.rb

Overview

Formats Groups in unified format. This format shows Groups of related operations, providing a script of changes to be made that is both human and computer readable. For more information, see http://en.wikipedia.org/wiki/Diff#Unified_format.

This format is used by Lookout::Difference::String for multi-line Strings.

Defined Under Namespace

Classes: ToS

Instance Method Summary collapse

Instance Method Details

# {|string| ... } ⇒ Object #Enumerator<String>

Overloads:

  • # {|string| ... } ⇒ Object

    Enumerates the formatted groups.

    Yield Parameters:

  • #Enumerator<String>

    Returns An Enumerator over the formatted groups.

    Returns:

    • (Enumerator<String>)

      An Enumerator over the formatted groups



21
22
23
24
25
26
27
28
# File 'lib/lookout-3.0/diff/formats/unified.rb', line 21

def each
  return enum_for(__method__) unless block_given?
  groups.each do |group|
    next if group.parity?
    yield ToS.new(group).to_s
  end
  self
end

#to_sObject

Returns The concatenation of the formatted groups.

Returns:

  • The concatenation of the formatted groups



31
# File 'lib/lookout-3.0/diff/formats/unified.rb', line 31

def to_s; to_a.join("\n") end