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

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

Instance Method Summary collapse

Constructor Details

#initialize(operation) ⇒ ToS

Returns a new instance of ToS.



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

def initialize(operation) @lines = operation.apply(self) end

Instance Method Details

#copy(operation) ⇒ Object



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

def copy(operation) end

#delete(operation) ⇒ Object



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

def delete(operation) mark('-', operation.old) end

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?; @lines.nil? end

#insert(operation) ⇒ Object



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

def insert(operation) mark('+', operation.new) end

#replace(operation) ⇒ Object



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

def replace(operation) delete(operation) + insert(operation) end

#to_sObject



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

def to_s; @lines.join("\n") end