Class: Xcodeproj::Project::Object::AbstractObject
- Inherits:
-
Object
- Object
- Xcodeproj::Project::Object::AbstractObject
- Defined in:
- lib/synx/xcodeproj_ext/project/object/abstract_object.rb
Instance Method Summary collapse
- #basename ⇒ Object
- #ensure_internal_consistency(group) ⇒ Object
- #referring_groups ⇒ Object
- #sync(group) ⇒ Object
- #work_pathname ⇒ Object
Instance Method Details
#basename ⇒ Object
6 7 8 |
# File 'lib/synx/xcodeproj_ext/project/object/abstract_object.rb', line 6 def basename name || path || Pathname(real_path).basename.to_s end |
#ensure_internal_consistency(group) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/synx/xcodeproj_ext/project/object/abstract_object.rb', line 32 def ensure_internal_consistency(group) @removed_from_groups = [] # Objects should only have one referring group -- this is an internal consistency issue if there is more than 1. # Just remove all referring groups but the one we're passed referring_groups.each do |rg| unless rg == group rg.remove_reference(self) @removed_from_groups << rg.hierarchy_path end end end |
#referring_groups ⇒ Object
10 11 12 |
# File 'lib/synx/xcodeproj_ext/project/object/abstract_object.rb', line 10 def referring_groups referrers.select { |ref| ref.is_a?(Xcodeproj::Project::Object::PBXGroup) } end |
#sync(group) ⇒ Object
44 45 46 |
# File 'lib/synx/xcodeproj_ext/project/object/abstract_object.rb', line 44 def sync(group) raise NotImplementedError end |
#work_pathname ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/synx/xcodeproj_ext/project/object/abstract_object.rb', line 14 def work_pathname # Intuitively, we want the work pathname to correspond 1-1 with the # view in the project hierarchy. Xcode's collapsed display of # identically-named localized files causes some complications, leading # to the special cases here. if self.equal?(project.main_group) @work_pathname ||= project.work_root_pathname elsif parent.is_a?(Xcodeproj::Project::Object::PBXVariantGroup) # Localized object, naming is handled differently. @work_pathname ||= parent.work_pathname + "#{display_name}.lproj" + parent.display_name elsif is_a?(Xcodeproj::Project::Object::PBXVariantGroup) # Localized container, has no path of its own. @work_pathname ||= parent.work_pathname else @work_pathname ||= parent.work_pathname + display_name end end |