class XcodeProject::FileNode

Constants

SourceTreeMap

Attributes

name[R]
path[R]
source_tree[R]

Public Class Methods

new(root, uuid, data) click to toggle source
Calls superclass method
# File lib/xcodeproject/file_node.rb, line 34
def initialize(root, uuid, data)
  super(root, uuid, data)

  @source_tree = data['sourceTree']
  @name ||= data['name']
  @path ||= data['path']

  @name ||= File.basename(@path) unless @path.nil?
end

Public Instance Methods

group_path() click to toggle source
# File lib/xcodeproject/file_node.rb, line 54
def group_path
  obj = self
  res = ''
  loop do
    pn = obj.name ? obj.name : ''
    res = Pathname.new(pn).join(res)
    break unless (obj = obj.parent)
  end
  res.cleanpath
end
parent() click to toggle source
# File lib/xcodeproject/file_node.rb, line 48
def parent
  root.select_objects { |_uuid, data|
    (data['children'].include?(uuid) if data['isa'] == 'PBXGroup') ? true : false
  }.first
end
total_path() click to toggle source
# File lib/xcodeproject/file_node.rb, line 65
def total_path
  res = ''
  case source_tree
  when :source_root
    res = path
  when :group
    pn = path.nil? ? '' : path
    res = parent.total_path.join(pn) unless parent.nil?
  else
    raise ParseError, "No such '#{source_tree}' source tree type."
  end
  root.absolute_path(res)
end