Top Level Namespace

Defined Under Namespace

Modules: CocoapodsKz, KZ, Pod, Xcodeproj

Instance Method Summary collapse

Instance Method Details

#write_to_path(hash, path) ⇒ Object

Raises:

  • (IOError)


8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cocoapods-kz/resources/on_demand_resources/kz_on_demand_resources_process.rb', line 8

def write_to_path(hash, path)
  unless path.is_a?(String) || path.is_a?(Pathname)
    raise TypeError, "The given `#{path}` must be a string or 'pathname'."
  end
  path = path.to_s
  raise IOError, 'Empty path.' if path.empty?

  File.open(path, 'w') do |f|
    plist = Nanaimo::Plist.new(hash, :xml)
    Nanaimo::Writer::XMLWriter.new(plist, :pretty => true, :output => f, :strict => false).write
  end
end