Module: Archimate::DataModel::DiffablePrimitive::DiffablePrimitiveMethods

Defined in:
lib/archimate/data_model/diffable_primitive.rb

Instance Method Summary collapse

Instance Method Details

#build_index(index_hash) ⇒ Object



29
30
31
# File 'lib/archimate/data_model/diffable_primitive.rb', line 29

def build_index(index_hash)
  index_hash
end

#cloneObject



41
42
43
# File 'lib/archimate/data_model/diffable_primitive.rb', line 41

def clone
  self
end

#compact!Object



49
50
51
# File 'lib/archimate/data_model/diffable_primitive.rb', line 49

def compact!
  self
end

#diff(other, from_parent, to_parent, attribute, from_attribute = nil) ⇒ Object

Raises:

  • (TypeError)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/archimate/data_model/diffable_primitive.rb', line 6

def diff(other, from_parent, to_parent, attribute, from_attribute = nil)
  from_attribute = attribute if from_attribute.nil?
  if other.nil?
    return [Diff::Delete.new(
      Diff::ArchimateNodeAttributeReference.new(from_parent, attribute)
    )]
  end
  raise TypeError, "Expected other #{other.class} to be of type #{self.class}" unless other.is_a?(self.class)
  unless self == other
    return [Diff::Change.new(
      Diff::ArchimateNodeReference.for_node(to_parent, attribute),
      Diff::ArchimateNodeReference.for_node(from_parent, from_attribute)
    )]
  end
  []
end

#dupObject



45
46
47
# File 'lib/archimate/data_model/diffable_primitive.rb', line 45

def dup
  self
end

#idObject



37
38
39
# File 'lib/archimate/data_model/diffable_primitive.rb', line 37

def id
  object_id.to_s
end

#in_model=(_m) ⇒ Object



23
# File 'lib/archimate/data_model/diffable_primitive.rb', line 23

def in_model=(_m); end

#parent=(_p) ⇒ Object



25
# File 'lib/archimate/data_model/diffable_primitive.rb', line 25

def parent=(_p); end

#parent_attribute_name=(_attr_name) ⇒ Object



27
# File 'lib/archimate/data_model/diffable_primitive.rb', line 27

def parent_attribute_name=(_attr_name); end

#primitive?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/archimate/data_model/diffable_primitive.rb', line 33

def primitive?
  true
end

#referenced_identified_nodesObject



53
54
55
# File 'lib/archimate/data_model/diffable_primitive.rb', line 53

def referenced_identified_nodes
  []
end