Class: Xcodeproj::Project::Object::AbstractObject

Inherits:
Object
  • Object
show all
Defined in:
lib/synx/abstract_object.rb

Instance Method Summary collapse

Instance Method Details

#basenameObject



8
9
10
# File 'lib/synx/abstract_object.rb', line 8

def basename
  name || path || Pathname(real_path).basename.to_s
end

#ensure_internal_consistency(group) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/synx/abstract_object.rb', line 21

def ensure_internal_consistency(group)
  @removed_from_groups = []
  if referring_groups.count > 1
    # Files 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 syncing with

    referring_groups.each do |rg|
      unless rg == group
        rg.remove_reference(self) unless rg == group
        @removed_from_groups << rg.hierarchy_path
      end
    end

  end
end

#referring_groupsObject



12
13
14
# File 'lib/synx/abstract_object.rb', line 12

def referring_groups
  referrers.select { |ref| ref.instance_of?(Xcodeproj::Project::Object::PBXGroup) }
end

#sync(group) ⇒ Object

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/synx/abstract_object.rb', line 37

def sync(group)
  raise NotImplementedError
end

#work_pathnameObject



16
17
18
19
# File 'lib/synx/abstract_object.rb', line 16

def work_pathname
  # hierarchy path has a leading '/' that will break path concatenation
  @work_pathname ||= project.work_root_pathname + hierarchy_path[1..-1]
end