Class: Archimate::DataModel::ReferenceableList
- Inherits:
-
Object
- Object
- Archimate::DataModel::ReferenceableList
show all
- Extended by:
- Forwardable
- Includes:
- Referenceable
- Defined in:
- lib/archimate/data_model/referenceable_list.rb
Overview
A list of things that can be referenced by another entity.
Instance Attribute Summary collapse
Instance Method Summary
collapse
#add_reference, #destroy, #model, #references, #remove_reference, #replace_item_with
Constructor Details
#initialize(parent, contents = [], parent_attr_references = []) ⇒ ReferenceableList
Returns a new instance of ReferenceableList.
43
44
45
46
47
48
|
# File 'lib/archimate/data_model/referenceable_list.rb', line 43
def initialize(parent, contents = [], parent_attr_references = [])
@parent = parent
@parent_attr_references = parent_attr_references
@list = contents || []
add_references
end
|
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
41
42
43
|
# File 'lib/archimate/data_model/referenceable_list.rb', line 41
def parent
@parent
end
|
Instance Method Details
#<<(item) ⇒ Object
66
67
68
69
70
|
# File 'lib/archimate/data_model/referenceable_list.rb', line 66
def <<(item)
return if @list.include?(item)
add_item_references(item)
@list << item
end
|
#delete(item) ⇒ Object
72
73
74
75
|
# File 'lib/archimate/data_model/referenceable_list.rb', line 72
def delete(item)
@list.delete(item)
remove_item_references(item)
end
|
#push(item) ⇒ Object
60
61
62
63
64
|
# File 'lib/archimate/data_model/referenceable_list.rb', line 60
def push(item)
return if @list.include?(item)
add_item_references(item)
@list.push(item)
end
|
#replace_with(contents) ⇒ Object
50
51
52
53
54
|
# File 'lib/archimate/data_model/referenceable_list.rb', line 50
def replace_with(contents)
remove_references
@list = contents
add_references
end
|
#to_ary ⇒ Object
56
57
58
|
# File 'lib/archimate/data_model/referenceable_list.rb', line 56
def to_ary
Array.new(@list).freeze
end
|