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



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

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

Instance Attribute Details

#consumerSpecification::Consumer



72
73
74
# File 'lib/cocoapods-core/specification/linter/result.rb', line 72

def consumer
  @consumer
end

#resultsArray<Result> (readonly, private)



100
101
102
# File 'lib/cocoapods-core/specification/linter/result.rb', line 100

def results
  @results
end

Instance Method Details

#add_error(attribute_name, message, public_only = false) ⇒ void

This method returns an undefined value.

Adds an error result with the given message.



81
82
83
# 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_result(type, attribute_name, message, public_only) ⇒ 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.



115
116
117
118
119
120
121
122
123
124
# 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

#add_warning(attribute_name, message, public_only = false) ⇒ void

This method returns an undefined value.

Adds a warning result with the given message.



92
93
94
# 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

#eachObject



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

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

#empty?Boolean



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

def empty?
  results.empty?
end