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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, attribute_name, message) ⇒ Result

Returns a new instance of Result

Parameters:

  • type (Symbol)

    @see type

  • message (String)

    @see message


23
24
25
26
27
28
# File 'lib/cocoapods-core/specification/linter/result.rb', line 23

def initialize(type, attribute_name, message)
  @type    = type
  @attribute_name = attribute_name
  @message = message
  @platforms = []
end

Instance Attribute Details

#attribute_nameObject (readonly)

@return[String] the name of the attribute associated with result.


14
15
16
# File 'lib/cocoapods-core/specification/linter/result.rb', line 14

def attribute_name
  @attribute_name
end

#messageString (readonly)

Returns the message associated with result.

Returns:

  • (String)

    the message associated with result.


18
19
20
# File 'lib/cocoapods-core/specification/linter/result.rb', line 18

def message
  @message
end

#platformsArray<Platform> (readonly)

Returns the platforms where this result was generated.

Returns:

  • (Array<Platform>)

    the platforms where this result was generated.


33
34
35
# File 'lib/cocoapods-core/specification/linter/result.rb', line 33

def platforms
  @platforms
end

#typeSymbol (readonly)

Returns the type of result.

Returns:

  • (Symbol)

    the type of result.


10
11
12
# File 'lib/cocoapods-core/specification/linter/result.rb', line 10

def type
  @type
end

Instance Method Details

#to_sString

Returns a string representation suitable for UI output.

Returns:

  • (String)

    a string representation suitable for UI output.


37
38
39
40
41
42
43
44
45
46
# File 'lib/cocoapods-core/specification/linter/result.rb', line 37

def to_s
  r = "[#{type.to_s.upcase}] [#{attribute_name}] #{message}"
  if platforms != Specification::PLATFORMS
    platforms_names = platforms.uniq.map do |p|
      Platform.string_name(p)
    end
    r << " [#{platforms_names * ' - '}]" unless platforms.empty?
  end
  r
end