Method: Pod::Podfile.from_hash

Defined in:
lib/cocoapods-core/podfile.rb

.from_hash(hash, path = nil) ⇒ Podfile

Configures a new Podfile from the given hash.

Parameters:

  • hash (Hash)

    The hash which contains the information of the Podfile.

  • path (Pathname) (defaults to: nil)

    The path from which the Podfile is loaded.

Returns:



369
370
371
372
373
374
375
376
377
378
# File 'lib/cocoapods-core/podfile.rb', line 369

def self.from_hash(hash, path = nil)
  internal_hash = hash.dup
  target_definitions = internal_hash.delete('target_definitions') || []
  podfile = Podfile.new(path, internal_hash)
  target_definitions.each do |definition_hash|
    definition = TargetDefinition.from_hash(definition_hash, podfile)
    podfile.root_target_definitions << definition
  end
  podfile
end