Class: XcodeProject::PBXFileReference
- Defined in:
- lib/xcodeproject/pbx_file_reference.rb
Instance Attribute Summary
Attributes inherited from FileNode
Attributes inherited from Node
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(root, uuid, data) ⇒ PBXFileReference
constructor
A new instance of PBXFileReference.
- #remove! ⇒ Object
Methods inherited from FileNode
#group_path, #parent, #total_path
Constructor Details
#initialize(root, uuid, data) ⇒ PBXFileReference
Returns a new instance of PBXFileReference.
6 7 8 |
# File 'lib/xcodeproject/pbx_file_reference.rb', line 6 def initialize (root, uuid, data) super(root, uuid, data) end |
Class Method Details
.add(root, path) ⇒ Object
19 20 21 22 |
# File 'lib/xcodeproject/pbx_file_reference.rb', line 19 def self.add(root, path) uuid, data = root.add_object(self.create_object_hash(path)) self.new(root, uuid, data) end |
.create_object_hash(path) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/xcodeproject/pbx_file_reference.rb', line 26 def self.create_object_hash (path) path = path.to_s name = File.basename(path) ext = File.extname(path) raise ParseError.new("No such file type '#{name}'.") if !FileTypeMap.include?(ext) data = [] data << ['isa', 'PBXFileReference'] data << ['sourceTree', '<group>'] data << ['fileEncoding', '4'] # utf-8 data << ['lastKnownFileType', FileTypeMap[ext]] data << ['path', path] data << ['name', name] if name != path Hash[ data ] end |