Class: Xcodeproj::Pbxproj::PbxObject::PbxSort
- Inherits:
-
Object
- Object
- Xcodeproj::Pbxproj::PbxObject::PbxSort
- Defined in:
- lib/xsort/xcodeproj/pbxproj/pbxobject/PbxSort.rb
Instance Method Summary collapse
- #childrenSort(children, sort) ⇒ Object
-
#initialize(pbxs) ⇒ PbxSort
constructor
A new instance of PbxSort.
- #psort ⇒ Object
Constructor Details
#initialize(pbxs) ⇒ PbxSort
Returns a new instance of PbxSort.
17 18 19 |
# File 'lib/xsort/xcodeproj/pbxproj/pbxobject/PbxSort.rb', line 17 def initialize(pbxs) @pbxs = pbxs end |
Instance Method Details
#childrenSort(children, sort) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/xsort/xcodeproj/pbxproj/pbxobject/PbxSort.rb', line 52 def childrenSort (children, sort) pbx = "" pbxSplit = children.split("\n") isPbxChild = false num = 0 pbxSplit.each{|pbxLine| if pbxLine.index(");") isPbxChild = false end if isPbxChild == true pbxLine = sort[num] num += 1 else pbxLine << "\n" end # Children if pbxLine.index("children = (") isPbxChild = true end pbx << pbxLine } return pbx end |
#psort ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/xsort/xcodeproj/pbxproj/pbxobject/PbxSort.rb', line 21 def psort sorteds = Array.new productPbx = "" @pbxs.each{ |pbx| sort = pbx.children.sort{|pbx1, pbx2| pbx1.name <=> pbx2.name } child = Array.new sort.each {|pbx| if pbx.name == "Products" productPbx = pbx.childPbx else child.push(pbx.childPbx) end } if productPbx.length != 0 child.push(productPbx) productPbx = "" end sorteds.push(childrenSort(pbx.pbxBase,child)) } return sorteds end |