Method: Pod._eval_podspec

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

._eval_podspec(string, path) ⇒ Object (private)

Evaluates the given string in the namespace of the Pod module.

Parameters:

  • string (String)

    The string containing the Ruby description of the Object to evaluate.

  • path (Pathname)

    The path where the object to evaluate is stored.

Returns:

  • (Object)

    it can return any object but, is expected to be called on podspec files that should return a #Specification.



843
844
845
846
847
848
849
850
851
852
853
# File 'lib/cocoapods-core/specification.rb', line 843

def self._eval_podspec(string, path)
  # rubocop:disable Security/Eval
  eval(string, nil, path.to_s)
  # rubocop:enable Security/Eval

  # rubocop:disable Lint/RescueException
rescue Exception => e
  # rubocop:enable Lint/RescueException
  message = "Invalid `#{path.basename}` file: #{e.message}"
  raise DSLError.new(message, path, e, string)
end