module CFBundle::Plist

@private

Utility methods for manipulating Property list files.

Public Class Methods

load_info_plist(bundle) click to toggle source

Loads the Info.plist file in a bundle. @param bundle [Bundle] The bundle to search. @return [Hash]

# File lib/cfbundle/plist.rb, line 12
def load_info_plist(bundle)
  load_plist(bundle, info_plist_path_in(bundle))
end
load_plist(bundle, path) click to toggle source

Loads a Propery list file in a bundle. @param bundle [Bundle] The bundle to search. @param path [String] The path to the Property list file in the bundle. @return [Hash]

# File lib/cfbundle/plist.rb, line 20
def load_plist(bundle, path)
  data = bundle.storage.open(path, &:read)
  plist = CFPropertyList::List.new(data: data)
  CFPropertyList.native_types(plist.value)
end

Private Class Methods

info_plist_path_in(bundle) click to toggle source
# File lib/cfbundle/plist.rb, line 28
def info_plist_path_in(bundle)
  case bundle.send :layout_version
  when 0 then 'Resources/Info.plist'
  when 2 then 'Contents/Info.plist'
  when 3 then 'Info.plist'
  end
end