class Xcodeproj::Workspace::FileReference


Describes a file reference of a Workspace.

def self.from_node(xml_node)

Returns:
  • (FileReference) - The new file reference instance.

Parameters:
  • xml_node (REXML::Element) --
def self.from_node(xml_node)
  type, path = xml_node.attribute('location').value.split(':', 2)
  new(path, type)
end

def ==(other)

Returns:
  • (Bool) - Wether a file reference is equal to another.
def ==(other)
  path == other.path && type == other.type
end

def absolute_path(workspace_dir_path)

Returns:
  • (String) - The absolute path to the project.

Parameters:
  • workspace_dir_path (#to_s) --
def absolute_path(workspace_dir_path)
  workspace_dir_path = workspace_dir_path.to_s
  case type
  when 'group'
    File.expand_path(File.join(workspace_dir_path, path))
  when 'container'
    File.expand_path(File.join(workspace_dir_path, path))
  when 'absolute'
    File.expand_path(path)
  when 'developer'
    raise 'Developer workspace file reference type is not yet ' \
      "#{self}"
  else
    raise "Unsupported workspace file reference type #{type}"
  end
end

def hash

Returns:
  • (Fixnum) - A hash identical for equals objects.
def hash
  [path, type].hash
end

def initialize(path, type = 'group')

Parameters:
  • type (#to_s) -- @see type
  • path (#to_s) -- @see path
def initialize(path, type = 'group')
  @path = path.to_s
  @type = type.to_s
end

def to_node

Returns:
  • (REXML::Element) - the XML representation of the file reference.
def to_node
  REXML::Element.new('FileRef').tap do |element|
    element.add_attribute('location', "#{type}:#{path}")
  end
end