Class: Pelusa::Analysis

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

Overview

Public: An Analysis the result of applying a Lint check to a class.

Examples

analysis = SuccessfulAnalysis.new("Is below 50 lines")
analysis.successful?
# => true

failure = FailedAnalysis.new("Is below 50 lines", 123) do |lines|
  "There are too many lines (#{lines})"
end
failure.successful?
# => false
failure.message
# => "There are too many lines (123)"

Direct Known Subclasses

FailedAnalysis, SuccessfulAnalysis

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Analysis


19
20
21
# File 'lib/pelusa/analysis.rb', line 19

def initialize(name)
  @name = name
end

Instance Method Details

#failed?Boolean


31
32
33
# File 'lib/pelusa/analysis.rb', line 31

def failed?
  not successful?
end

#messageObject


35
36
37
# File 'lib/pelusa/analysis.rb', line 35

def message
  ""
end

#nameObject


23
24
25
# File 'lib/pelusa/analysis.rb', line 23

def name
  @name
end

#statusObject


39
40
41
# File 'lib/pelusa/analysis.rb', line 39

def status
  successful? ? "successful" : "failed"
end

#successful?Boolean

Raises:

  • (NotImplementedError)

27
28
29
# File 'lib/pelusa/analysis.rb', line 27

def successful?
  raise NotImplementedError
end