Class: Pod::Specification::Linter::Results

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/cocoapods-core/specification/linter/result.rb

Defined Under Namespace

Classes: Result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResults


49
50
51
52
# File 'lib/cocoapods-core/specification/linter/result.rb', line 49

def initialize
  @results = []
  @consumer = nil
end

Instance Attribute Details

#consumerSpecification::Consumer


66
67
68
# File 'lib/cocoapods-core/specification/linter/result.rb', line 66

def consumer
  @consumer
end

#resultsArray<Result> (readonly, private)


94
95
96
# File 'lib/cocoapods-core/specification/linter/result.rb', line 94

def results
  @results
end

Instance Method Details

#add_error(attribute_name, message) ⇒ void

This method returns an undefined value.

Adds an error result with the given message.


75
76
77
# File 'lib/cocoapods-core/specification/linter/result.rb', line 75

def add_error(attribute_name, message)
  add_result(:error, attribute_name, message)
end

#add_result(type, attribute_name, message) ⇒ void (private)

This method returns an undefined value.

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.


109
110
111
112
113
114
115
116
117
118
# File 'lib/cocoapods-core/specification/linter/result.rb', line 109

def add_result(type, attribute_name, message)
  result = results.find do |r|
    r.type == type && r.attribute_name == attribute_name && r.message == message
  end
  unless result
    result = Result.new(type, attribute_name, message)
    results << result
  end
  result.platforms << @consumer.platform_name if @consumer
end

#add_warning(attribute_name, message) ⇒ void

This method returns an undefined value.

Adds a warning result with the given message.


86
87
88
# File 'lib/cocoapods-core/specification/linter/result.rb', line 86

def add_warning(attribute_name, message)
  add_result(:warning, attribute_name, message)
end

#eachObject


56
57
58
# File 'lib/cocoapods-core/specification/linter/result.rb', line 56

def each
  results.each { |r| yield r }
end

#empty?Boolean


60
61
62
# File 'lib/cocoapods-core/specification/linter/result.rb', line 60

def empty?
  results.empty?
end