Class: XcodeProject::PBXBuildFile

Inherits:
Node
  • Object
show all
Defined in:
lib/xcodeproject/pbx_build_file.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#isa, #uuid

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root, uuid, data) ⇒ PBXBuildFile

Returns a new instance of PBXBuildFile.



31
32
33
34
35
# File 'lib/xcodeproject/pbx_build_file.rb', line 31

def initialize(root, uuid, data)
  super(root, uuid, data)

  @file_ref = data['fileRef']
end

Instance Attribute Details

#file_refObject (readonly)

Returns the value of attribute file_ref.



29
30
31
# File 'lib/xcodeproject/pbx_build_file.rb', line 29

def file_ref
  @file_ref
end

Class Method Details

.add(root, file_ref_uuid) ⇒ Object



48
49
50
51
# File 'lib/xcodeproject/pbx_build_file.rb', line 48

def self.add(root, file_ref_uuid)
  uuid, data = root.add_object(create_object_hash(file_ref_uuid))
  new(root, uuid, data)
end

.create_object_hash(file_ref_uuid) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/xcodeproject/pbx_build_file.rb', line 55

def self.create_object_hash(file_ref_uuid)
  data = []
  data << %w[isa PBXBuildFile]
  data << ['fileRef', file_ref_uuid]

  Hash[data]
end

Instance Method Details

#remove!Object



41
42
43
44
45
46
# File 'lib/xcodeproject/pbx_build_file.rb', line 41

def remove!
  root.project.targets.each do |target|
    target.remove_source(self)
  end
  root.remove_object(uuid)
end