Class: Archimate::Diff::Delete

Inherits:
Difference show all
Defined in:
lib/archimate/diff/delete.rb

Constant Summary

Constants inherited from Difference

Archimate::Diff::Difference::ARRAY_RE, Archimate::Diff::Difference::PATH_ROOT_SORT_ORDER

Instance Attribute Summary

Attributes inherited from Difference

#changed_from, #target

Instance Method Summary collapse

Methods inherited from Difference

#<=>, #==, #change?, #insert?, #move?, #path_to_array, #summary_element

Constructor Details

#initialize(target) ⇒ Delete

Create a new Delete difference

Parameters:



11
12
13
# File 'lib/archimate/diff/delete.rb', line 11

def initialize(target)
  super
end

Instance Method Details

#apply(el) ⇒ Object



21
22
23
24
# File 'lib/archimate/diff/delete.rb', line 21

def apply(el)
  target.delete(el)
  el
end

#delete?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/archimate/diff/delete.rb', line 26

def delete?
  true
end

#kindObject



30
31
32
# File 'lib/archimate/diff/delete.rb', line 30

def kind
  "Delete"
end

#to_sObject



15
16
17
18
19
# File 'lib/archimate/diff/delete.rb', line 15

def to_s
  # Note - the explicit to_s is required to access the DiffableArray
  #        implementation if the parent is an Array.
  "#{diff_type} #{target} from #{target.parent.to_s}"
end