Method: XcodeProject::PBXGroup#child

Defined in:
lib/xcodeproject/pbx_group.rb

#child(gpath) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/xcodeproject/pbx_group.rb', line 48

def child (gpath)
  gpath = Pathname.new(gpath).cleanpath
  
  if gpath == gpath.basename
    name = gpath.to_s
    case name
      when '.'
        self
      when '..'
        parent
      else
        chs = children.select {|obj| obj.name == name }
        raise GroupPathError.new("The group contains two children with the same name.") if chs.size > 1
        chs.first
    end
  else
    pn, name = gpath.split
    group = child(pn)
    group.child(name) if group.is_a?(PBXGroup)
  end
end