Class: Pelusa::FailedAnalysis

Inherits:
Analysis
  • Object
show all
Defined in:
lib/pelusa/analysis.rb

Overview

Public: A FailedAnalysis is an analysis that has failed a particular lint check.

Instance Method Summary collapse

Methods inherited from Analysis

#failed?, #name, #status

Constructor Details

#initialize(name, payload, &block) ⇒ FailedAnalysis

Public: Initializes a new FailedAnalysis.

name - The name of the lint check. payload - An object to use in the message to aid the user in fixing the

problem.

block - A block to generate the message. It must yield the payload

object.


67
68
69
70
71
# File 'lib/pelusa/analysis.rb', line 67

def initialize(name, payload, &block)
  super(name)
  @payload = payload
  @block   = block
end

Instance Method Details

#messageObject

Public: Generates an explicative message yielding the payload object to the block, so that the user gets some hint to fix the problem.

Returns the String message.



84
85
86
# File 'lib/pelusa/analysis.rb', line 84

def message
  @block.call(@payload)
end

#successful?Boolean

Public: A failed analysis is never successful , obviously.

Returns false.

Returns:

  • (Boolean)


76
77
78
# File 'lib/pelusa/analysis.rb', line 76

def successful?
  false
end