Class: Xcode::Project::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/xcode/project/config.rb,
lib/xcode/project/config/decomment.rb,
lib/xcode/project/config/array_node.rb,
lib/xcode/project/config/io_scanner.rb,
lib/xcode/project/config/object_node.rb

Defined Under Namespace

Modules: Decomment Classes: ArrayNode, IOScanner, ObjectNode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Returns a new instance of Config.



10
11
12
13
14
# File 'lib/xcode/project/config.rb', line 10

def initialize(path)
  @path = Pathname(path)
  @pbxproj_path = path + 'project.pbxproj'
  parse
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/xcode/project/config.rb', line 9

def path
  @path
end

#pbxproj_pathObject (readonly)

Returns the value of attribute pbxproj_path.



9
10
11
# File 'lib/xcode/project/config.rb', line 9

def pbxproj_path
  @pbxproj_path
end

#rootObject (readonly)

Returns the value of attribute root.



9
10
11
# File 'lib/xcode/project/config.rb', line 9

def root
  @root
end

Instance Method Details

#parseObject



16
17
18
19
20
21
22
23
24
# File 'lib/xcode/project/config.rb', line 16

def parse
  @root = nil
  File.open(pbxproj_path) do |io|
    ios = IOScanner.new(io)
    token = ios.tokenize
    raise 'Unable to deserialize root object.' if token != ?{
    @root = ObjectNode.new(io)
  end
end