Module: ZergXcode::Objects::PBXProject::FileVisitor
- Defined in:
- lib/zerg_xcode/objects/pbx_project.rb
Overview
Container for the visitor that lists all files in a project.
Class Method Summary collapse
- .merge_path(old_path, source_tree, object) ⇒ Object
- .visit(object, root_path, files) ⇒ Object
- .visit_file(file, root_path, files) ⇒ Object
- .visit_group(group, root_path, files) ⇒ Object
Class Method Details
.merge_path(old_path, source_tree, object) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 56 def self.merge_path(old_path, source_tree, object) case source_tree when '<group>' base_path = old_path else base_path = source_tree end if object['path'] path = File.join(base_path, object['path']) else path = old_path end return path end |
.visit(object, root_path, files) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 33 def self.visit(object, root_path, files) case object.isa when :PBXGroup visit_group(object, root_path, files) when :PBXFileReference visit_file(object, root_path, files) end end |
.visit_file(file, root_path, files) ⇒ Object
50 51 52 53 54 |
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 50 def self.visit_file(file, root_path, files) path = merge_path(root_path, file['sourceTree'], file) files << { :path => path, :object => file } end |
.visit_group(group, root_path, files) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 42 def self.visit_group(group, root_path, files) path = merge_path(root_path, group['sourceTree'], group) group['children'].each do |child| visit child, path, files end end |