Class: Defgen::XcodeprojAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/defgen/xcodeproj_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(proj, path) ⇒ XcodeprojAdapter

Returns a new instance of XcodeprojAdapter.



5
6
7
# File 'lib/defgen/xcodeproj_adapter.rb', line 5

def initialize proj, path
  @proj, @path = proj, path
end

Instance Method Details

#main_groupObject



30
31
32
# File 'lib/defgen/xcodeproj_adapter.rb', line 30

def main_group
  root_object.main_group.groups.first
end

#main_targetObject



34
35
36
# File 'lib/defgen/xcodeproj_adapter.rb', line 34

def main_target
  root_object.targets.first
end

#nameObject



9
10
11
# File 'lib/defgen/xcodeproj_adapter.rb', line 9

def name
  @proj.targets.first.name
end

#objectsObject



22
23
24
# File 'lib/defgen/xcodeproj_adapter.rb', line 22

def objects
  @proj.objects
end

#organizationObject



26
27
28
# File 'lib/defgen/xcodeproj_adapter.rb', line 26

def organization
  root_object.attributes['ORGANIZATIONNAME']
end

#prefixObject



13
14
15
16
17
18
19
20
# File 'lib/defgen/xcodeproj_adapter.rb', line 13

def prefix
  prefix = root_object.attributes['CLASSPREFIX']
  if prefix.nil? || prefix.empty?
    'PS'
  else
    prefix.upcase
  end
end

#saveObject



38
39
40
# File 'lib/defgen/xcodeproj_adapter.rb', line 38

def save
  @proj.save_as @path
end