class Xcodeproj::Workspace::GroupReference


Describes a group reference of a Workspace.

def self.from_node(xml_node)

Returns:
  • (GroupReference) - The new group reference instance.

Parameters:
  • xml_node (REXML::Element) --
def self.from_node(xml_node)
  location_array = xml_node.attribute('location').value.split(':', 2)
  type = location_array.first
  location = location_array[1] || ''
  if type == 'group'
    location = prepend_parent_path(xml_node, location)
  end
  name = xml_node.attribute('name').value
  new(name, type, location)
end

def ==(other)

Returns:
  • (Bool) - Whether a group reference is equal to another.
def ==(other)
  name == other.name && type == other.type && location == other.location
end

def hash

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

def initialize(name, type = 'container', location = '')

Parameters:
  • location (#to_s) -- @see location
  • type (#to_s) -- @see type
  • name (#to_s) -- @see name
def initialize(name, type = 'container', location = '')
  @name = name.to_s
  @type = type.to_s
  @location = location.to_s
end

def to_node

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