class Xcodeproj::Workspace::GroupReference
Describes a group reference of a Workspace
.
Attributes
location[R]
@return [String] the location of the group on disk
name[R]
@return [String] the name of the group
Public Class Methods
from_node(xml_node)
click to toggle source
Returns a group reference given XML representation.
@param [REXML::Element] xml_node
the XML representation.
@return [GroupReference] The new group reference instance.
# File lib/xcodeproj/workspace/group_reference.rb, line 46 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
new(name, type = 'container', location = '')
click to toggle source
@param [#to_s] name @see name @param [#to_s] type @see type @param [#to_s] location @see location
# File lib/xcodeproj/workspace/group_reference.rb, line 20 def initialize(name, type = 'container', location = '') @name = name.to_s @type = type.to_s @location = location.to_s end
Public Instance Methods
==(other)
click to toggle source
@return [Bool] Whether a group reference is equal to another.
# File lib/xcodeproj/workspace/group_reference.rb, line 28 def ==(other) name == other.name && type == other.type && location == other.location end
Also aliased as: eql?
hash()
click to toggle source
@return [Fixnum] A hash identical for equals objects.
# File lib/xcodeproj/workspace/group_reference.rb, line 35 def hash [name, type, location].hash end
to_node()
click to toggle source
@return [REXML::Element] the XML representation of the group reference.
# File lib/xcodeproj/workspace/group_reference.rb, line 59 def to_node REXML::Element.new('Group').tap do |element| element.add_attribute('location', "#{type}:#{location}") element.add_attribute('name', "#{name}") end end