Class: BuildEval::Result::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/build_eval/result/status.rb

Constant Summary collapse

SUCCESS =
new(severity: 0, symbol: :success!,  description: "succeeded")
BUILDING =
new(severity: 1, symbol: :building!, description: "building")
UNKNOWN =
new(severity: 2, symbol: :warning!,  description: "unknown")
INDETERMINATE =
new(severity: 3, symbol: :warning!,  description: "indeterminate")
FAILURE =
new(severity: 4, symbol: :failure!,  description: "failed")
ERROR =
new(severity: 5, symbol: :failure!,  description: "errored")

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#severityObject (readonly)

Returns the value of attribute severity


37
38
39
# File 'lib/build_eval/result/status.rb', line 37

def severity
  @severity
end

Class Method Details

.effective_status(statuses) ⇒ Object


31
32
33
# File 'lib/build_eval/result/status.rb', line 31

def effective_status(statuses)
  statuses.sort_by(&:severity).last
end

.find(name) ⇒ Object


25
26
27
28
29
# File 'lib/build_eval/result/status.rb', line 25

def find(name)
  const_get(name.upcase)
rescue NameError
  raise "Build status '#{name}' is invalid"
end

Instance Method Details

#to_sObject


47
48
49
# File 'lib/build_eval/result/status.rb', line 47

def to_s
  @description
end

#to_symObject


43
44
45
# File 'lib/build_eval/result/status.rb', line 43

def to_sym
  @symbol
end

#unsuccessful?Boolean

Returns:

  • (Boolean)

39
40
41
# File 'lib/build_eval/result/status.rb', line 39

def unsuccessful?
  ![ SUCCESS, BUILDING ].include?(self)
end