class Xcodeproj::Project::ObjectDictionary
@todo Cover all the mutations methods of the {Hash} class.
usually are implemented in C
Moreover it is a moving target because the methods of array
the hash methods should be covered, but this is not done yet.
which are overridden to inform objects reference count. Ideally all
@note Concerning the mutations methods it is safe to call only those
{AbstractObjectAttribute} and the {ObjectList}.
Also the interface is a dirty hybrid between the
generate setters and getters from the specification hash.
root_object.project_references.product_group = file
#=> This should raise:
root_object.project_references.project_ref = file
#=> Note the API:
This should be possible:
}
:product_group => PBXGroup
:project_ref => PBXFileReference,
has_many_references_by_keys :project_references, {
Give the following attribute:
support as the other classes the dictionary should be able to
and the keys of the dictionary are in camel-case. To provide full
{PBXProject#project_references}. It doesn’t perform type cheeking
@note This class is a stub currently only being used by
with reference count on modifications.
the project is not serialized with unreachable objects by updating the
It works in conjunction with the {AbstractObject} class to ensure that
Dictionary.
This class represents relationships to other objects stored in a
def []=(key, object)
-
(void)-
Parameters:
-
object(AbstractObject) -- -
key(String) --
def []=(key, object) if object perform_additions_operations(object) else perform_deletion_operations(self[key]) end super end
def add_referrer(referrer)
-
(void)-
def add_referrer(referrer) values.each { |obj| obj.add_referrer(referrer) } end
def delete(key)
-
(void)-
Parameters:
-
key(String) --
def delete(key) object = self[key] perform_deletion_operations(object) super end
def initialize(attribute, owner)
the synthesized methods generated by {AbstractObject.has_many}.
{ObjectDictionary}, it is always initialized empty and automatically by
{Xcodeproj} clients are not expected to create instances of
def initialize(attribute, owner) @attribute = attribute @owner = owner end
def perform_additions_operations(objects)
-
(void)-
def perform_additions_operations(objects) objects = [objects] unless objects.is_a?(Array) objects.each do |obj| obj.add_referrer(owner) attribute.validate_value(obj) end end
def perform_deletion_operations(objects)
-
(void)-
def perform_deletion_operations(objects) objects = [objects] unless objects.is_a?(Array) objects.each do |obj| obj.remove_referrer(owner) end end
def remove_reference(object)
-
(void)-
def remove_reference(object) each { |key, obj| self[key] = nil if obj == object } end
def remove_referrer(referrer)
-
(void)-
def remove_referrer(referrer) values.each { |obj| obj.remove_referrer(referrer) } end
def to_plist
-
(Hash-String>)
def to_plist result = {} each { |key, obj| result[key] = obj.uuid } result end
def to_tree_hash
-
(Hash-String>)
def to_tree_hash result = {} each { |key, obj| result[key] = obj.to_tree_hash } result end