class Pod::Specification::Linter::Results

Attributes

consumer[RW]

@return [Specification::Consumer] the current consumer.

results[R]

@return [Array<Result>] all of the generated results.

Public Class Methods

new() click to toggle source
# File lib/cocoapods-core/specification/linter/result.rb, line 55
def initialize
  @results = []
  @consumer = nil
end

Public Instance Methods

add_error(attribute_name, message, public_only = false) click to toggle source

Adds an error result with the given message.

@param [String] message

The message of the result.

@return [void]

# File lib/cocoapods-core/specification/linter/result.rb, line 81
def add_error(attribute_name, message, public_only = false)
  add_result(:error, attribute_name, message, public_only)
end
add_warning(attribute_name, message, public_only = false) click to toggle source

Adds a warning result with the given message.

@param [String] message

The message of the result.

@return [void]

# File lib/cocoapods-core/specification/linter/result.rb, line 92
def add_warning(attribute_name, message, public_only = false)
  add_result(:warning, attribute_name, message, public_only)
end
each() { |r| ... } click to toggle source
# File lib/cocoapods-core/specification/linter/result.rb, line 62
def each
  results.each { |r| yield r }
end
empty?() click to toggle source
# File lib/cocoapods-core/specification/linter/result.rb, line 66
def empty?
  results.empty?
end

Private Instance Methods

add_result(type, attribute_name, message, public_only) click to toggle source

Adds a result of the given type with the given message. If there is a current platform it is added to the result. If a result with the same type and the same message is already available the current platform is added to the existing result.

@param [Symbol] type

The type of the result (`:error`, `:warning`).

@param [String] message

The message of the result.

@return [void]

# File lib/cocoapods-core/specification/linter/result.rb, line 115
def add_result(type, attribute_name, message, public_only)
  result = results.find do |r|
    r.type == type && r.attribute_name == attribute_name && r.message == message && r.public_only? == public_only
  end
  unless result
    result = Result.new(type, attribute_name, message, public_only)
    results << result
  end
  result.platforms << @consumer.platform_name if @consumer
end