Class: Lookout::Diff::Formats::Set

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

Overview

Formats Operations on an undordered set. Added subsequences are shown having each element prefixed by “+” and deleted subsequences by “-”. Replaced subsequences are shown as a deleted subsequence followed by an added subsequence.

This format is used by Lookout::Difference::Hash.

Defined Under Namespace

Classes: ToS

Instance Method Summary collapse

Instance Method Details

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

Overloads:

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

    Enumerates the formatted operations.

    Yield Parameters:

  • #Enumerator<String>

    Returns Enumerator over the formatted operations.

    Returns:

    • (Enumerator<String>)

      Enumerator over the formatted operations



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

def each
  return enum_for(__method__) unless block_given?
  operations.each do |op|
    operation = ToS.new(op)
    yield operation.to_s unless operation.empty?
  end
  self
end

#to_sObject

Returns The concatenation of the formatted operations.

Returns:

  • The concatenation of the formatted operations



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

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