class Xcodeproj::Project::Object::AbstractObject

Public Instance Methods

basename() click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# 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) click to toggle source
# File lib/synx/xcodeproj_ext/project/object/abstract_object.rb, line 44
def sync(group)
  raise NotImplementedError
end
work_pathname() click to toggle source
# 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