class Pod::Generator::PrefixHeader
Generates a prefix header file for a Pods library. The prefix header is generated according to the platform of the target and the pods.
According to the platform the prefix header imports ‘UIKit/UIKit.h` or `Cocoa/Cocoa.h`.
Attributes
file_accessors[R]
@return [Array<FileAccessor>] The file accessors for which to generate
the prefix header.
Public Class Methods
new(file_accessors, platform)
click to toggle source
Initialize a new instance
@param [Array<FileAccessor>] file_accessors
@see #file_accessors
@param [Platform] platform
@see Header#platform
Calls superclass method
Pod::Generator::Header::new
# File lib/cocoapods/generator/prefix_header.rb, line 23 def initialize(file_accessors, platform) @file_accessors = file_accessors super platform end
Public Instance Methods
generate()
click to toggle source
Generates the contents of the prefix header according to the platform and the pods.
@note Only unique prefix_header_contents are added to the prefix
header.
@return [String]
@todo Subspecs can specify prefix header information too. @todo Check to see if we have a similar duplication issue with
file_accessor.prefix_header.
Calls superclass method
Pod::Generator::Header#generate
# File lib/cocoapods/generator/prefix_header.rb, line 40 def generate result = super unique_prefix_header_contents = file_accessors.map do |file_accessor| file_accessor.spec_consumer.prefix_header_contents end.compact.uniq unique_prefix_header_contents.each do |prefix_header_contents| result << prefix_header_contents result << "\n" end file_accessors.map(&:prefix_header).compact.uniq.each do |prefix_header| result << Pathname(prefix_header).read end result end