Class: Ovaltine::XcodeProject::PBXObject

Inherits:
Hash
  • Object
show all
Defined in:
lib/ovaltine/xcode_project/pbxobject.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Hash

#to_plist

Constructor Details

#initialize(uuid, hash) ⇒ PBXObject

Returns a new instance of PBXObject.



20
21
22
23
24
25
# File 'lib/ovaltine/xcode_project/pbxobject.rb', line 20

def initialize uuid, hash
  @project = nil
  @uuid = uuid
  self["isa"] = self.class.to_s.split('::').last
  hash.each { |k,v| self[k] = v }
end

Instance Attribute Details

#project_fileObject

Returns the value of attribute project_file.



5
6
7
# File 'lib/ovaltine/xcode_project/pbxobject.rb', line 5

def project_file
  @project_file
end

#uuidObject (readonly)

Returns the value of attribute uuid.



6
7
8
# File 'lib/ovaltine/xcode_project/pbxobject.rb', line 6

def uuid
  @uuid
end

Class Method Details

.create_uuidObject



14
15
16
17
18
# File 'lib/ovaltine/xcode_project/pbxobject.rb', line 14

def self.create_uuid
  uuid = ""
  24.times { uuid += "0123456789ABCDEF"[rand(16),1] }
  uuid
end

.filter(array, attrs) ⇒ Object



8
9
10
11
12
# File 'lib/ovaltine/xcode_project/pbxobject.rb', line 8

def self.filter array, attrs
  array.select do |obj|
    attrs.select { |k,v| obj[k] == v }.length == attrs.length
  end
end

Instance Method Details

#inspectObject



27
28
29
# File 'lib/ovaltine/xcode_project/pbxobject.rb', line 27

def inspect
  @uuid + "=" + super
end