Class: Swifterate::PList
- Inherits:
-
Object
- Object
- Swifterate::PList
- Defined in:
- lib/swifterate/plist.rb
Instance Method Summary collapse
-
#initialize(file) ⇒ PList
constructor
A new instance of PList.
- #keys ⇒ Object
- #members ⇒ Object
- #swift_enum(name = "InfoPlist") ⇒ Object
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
#keys ⇒ Object
13 14 15 |
# File 'lib/swifterate/plist.rb', line 13 def keys @data.keys end |
#members ⇒ Object
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 |