Module: CFBundle::Plist

Defined in:
lib/cfbundle/plist.rb

Overview

Utility methods for manipulating Property list files.

Class Method Summary collapse

Class Method Details

.load_info_plist(bundle) ⇒ Hash

Loads the Info.plist file in a bundle.

Parameters:

  • bundle (Bundle)

    The bundle to search.

Returns:

  • (Hash)


12
13
14
# 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) ⇒ Hash

Loads a Propery list file in a bundle.

Parameters:

  • bundle (Bundle)

    The bundle to search.

  • path (String)

    The path to the Property list file in the bundle.

Returns:

  • (Hash)


20
21
22
23
24
# 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