Class: Lookout::Diff::Formats::Set::ToS
- Defined in:
- lib/lookout-3.0/diff/formats/set.rb
Instance Method Summary collapse
- #copy(operation) ⇒ Object
- #delete(operation) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(operation) ⇒ ToS
constructor
A new instance of ToS.
- #insert(operation) ⇒ Object
- #replace(operation) ⇒ Object
- #to_s ⇒ Object
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
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_s ⇒ Object
42 |
# File 'lib/lookout-3.0/diff/formats/set.rb', line 42 def to_s; @lines.join("\n") end |