Class: Swifterate::PList

Inherits:
Object
  • Object
show all
Defined in:
lib/swifterate/plist.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ PList

Returns a new instance of PList.



8
9
10
11
# File 'lib/swifterate/plist.rb', line 8

def initialize(file)
  plist = CFPropertyList::List.new(file: file)
  @data = CFPropertyList.native_types(plist.value)
end

Instance Method Details

#keysObject



13
14
15
# File 'lib/swifterate/plist.rb', line 13

def keys
  @data.keys
end

#membersObject



17
18
19
# File 'lib/swifterate/plist.rb', line 17

def members
  Helper.enum_members(keys)
end

#swift_enum(name = "InfoPlist") ⇒ Object



21
22
23
24
# File 'lib/swifterate/plist.rb', line 21

def swift_enum(name = "InfoPlist")
  template_file = File.join(File.dirname(__FILE__), 'templates/InfoPlist.swift.mustache')
  Mustache.render(File.read(template_file), name: name, members: members)
end