Class: GeneValidator::ValidationReport

Inherits:
Object
  • Object
show all
Defined in:
lib/genevalidator/validation_report.rb

Overview

This is an abstract class extended by all validation reports

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = 'Not enough evidence', validation_result = :no, short_header = '', header = '', description = '', approach = '', explanation = '', conclusion = '') ⇒ ValidationReport

Initilizes the object Params: message: result of the validation (to be displayed in the output) validation_result: :yes for pass validation, :no for fail, :unapplicable or :error short_header: String header: String description: String by default)



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/genevalidator/validation_report.rb', line 34

def initialize(message = 'Not enough evidence', validation_result = :no,
               short_header = '', header = '', description = '',
               approach = '', explanation = '', conclusion = '')
  @message           = message
  @errors            = []
  @result            = validation_result
  @expected          = :yes
  @validation_result = validation_result
  @short_header      = short_header
  @header            = header
  @description       = description
  @approach          = approach
  @explanation       = explanation
  @conclusion        = conclusion
end

Instance Attribute Details

#approachObject

Returns the value of attribute approach.



20
21
22
# File 'lib/genevalidator/validation_report.rb', line 20

def approach
  @approach
end

#conclusionObject

Returns the value of attribute conclusion.



22
23
24
# File 'lib/genevalidator/validation_report.rb', line 22

def conclusion
  @conclusion
end

#descriptionObject

Returns the value of attribute description.



18
19
20
# File 'lib/genevalidator/validation_report.rb', line 18

def description
  @description
end

#errorsObject (readonly)

Returns the value of attribute errors.



15
16
17
# File 'lib/genevalidator/validation_report.rb', line 15

def errors
  @errors
end

#expectedObject (readonly)

Returns the value of attribute expected.



13
14
15
# File 'lib/genevalidator/validation_report.rb', line 13

def expected
  @expected
end

#explanationObject

Returns the value of attribute explanation.



21
22
23
# File 'lib/genevalidator/validation_report.rb', line 21

def explanation
  @explanation
end

#headerObject

Returns the value of attribute header.



17
18
19
# File 'lib/genevalidator/validation_report.rb', line 17

def header
  @header
end

#messageObject (readonly)

Returns the value of attribute message.



10
11
12
# File 'lib/genevalidator/validation_report.rb', line 10

def message
  @message
end

#plot_filesObject (readonly)

Returns the value of attribute plot_files.



11
12
13
# File 'lib/genevalidator/validation_report.rb', line 11

def plot_files
  @plot_files
end

#resultObject (readonly)

Returns the value of attribute result.



12
13
14
# File 'lib/genevalidator/validation_report.rb', line 12

def result
  @result
end

#run_timeObject

Returns the value of attribute run_time.



19
20
21
# File 'lib/genevalidator/validation_report.rb', line 19

def run_time
  @run_time
end

#short_headerObject

Returns the value of attribute short_header.



16
17
18
# File 'lib/genevalidator/validation_report.rb', line 16

def short_header
  @short_header
end

#validation_resultObject (readonly)

Returns the value of attribute validation_result.



14
15
16
# File 'lib/genevalidator/validation_report.rb', line 14

def validation_result
  @validation_result
end

Instance Method Details

#colorObject

May return “success” or “error”



60
61
62
63
64
65
66
67
68
# File 'lib/genevalidator/validation_report.rb', line 60

def color
  if validation == @expected
    'success'
  elsif validation == :error || validation == :unapplicable
    'warning'
  else
    validation == :warning ? 'warning' : 'danger'
  end
end


50
51
52
# File 'lib/genevalidator/validation_report.rb', line 50

def print
  message
end

#validationObject



54
55
56
# File 'lib/genevalidator/validation_report.rb', line 54

def validation
  validation_result
end