Class: Archimate::Diff::Insert
Constant Summary
Constants inherited
from Difference
Difference::ARRAY_RE, Difference::PATH_ROOT_SORT_ORDER
Instance Attribute Summary
Attributes inherited from Difference
#changed_from, #target
Instance Method Summary
collapse
Methods inherited from Difference
#<=>, #==, #change?, #delete?, #move?, #path_to_array, #summary_element
Constructor Details
#initialize(target) ⇒ Insert
Create a new Insert difference
12
13
14
|
# File 'lib/archimate/diff/insert.rb', line 12
def initialize(target)
super
end
|
Instance Method Details
#apply(to_model) ⇒ Object
22
23
24
25
26
|
# File 'lib/archimate/diff/insert.rb', line 22
def apply(to_model)
throw TypeError, "Expected a Archimate::DataModel::Model, was a #{to_model.class}" unless to_model.is_a?(DataModel::Model)
target.insert(to_model)
to_model
end
|
#insert? ⇒ Boolean
28
29
30
|
# File 'lib/archimate/diff/insert.rb', line 28
def insert?
true
end
|
#kind ⇒ Object
32
33
34
|
# File 'lib/archimate/diff/insert.rb', line 32
def kind
"Insert"
end
|
#to_s ⇒ Object
16
17
18
19
20
|
# File 'lib/archimate/diff/insert.rb', line 16
def to_s
"#{diff_type} #{target} into #{target.parent.to_s}"
end
|