Class: Phlex::Reactive::Doctor::Check

Inherits:
Object
  • Object
show all
Defined in:
lib/phlex/reactive/doctor.rb

Overview

The result of one check: a status (:ok/:fail/:unknown), a human message, and (on anything but :ok) a fix line telling the adopter what to do. A plain value object (not Data) so it takes positional status/message plus keyword name:/fix: — the shape the check builders and specs construct.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, message, name: nil, fix: nil) ⇒ Check

Returns a new instance of Check.



26
27
28
29
30
31
# File 'lib/phlex/reactive/doctor.rb', line 26

def initialize(status, message, name: nil, fix: nil)
  @name = name
  @status = status
  @message = message
  @fix = fix
end

Instance Attribute Details

#fixObject (readonly)

Returns the value of attribute fix.



24
25
26
# File 'lib/phlex/reactive/doctor.rb', line 24

def fix
  @fix
end

#messageObject (readonly)

Returns the value of attribute message.



24
25
26
# File 'lib/phlex/reactive/doctor.rb', line 24

def message
  @message
end

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/phlex/reactive/doctor.rb', line 24

def name
  @name
end

#statusObject (readonly)

Returns the value of attribute status.



24
25
26
# File 'lib/phlex/reactive/doctor.rb', line 24

def status
  @status
end

Instance Method Details

#fail?Boolean

Returns:

  • (Boolean)


34
# File 'lib/phlex/reactive/doctor.rb', line 34

def fail? = status == :fail

#ok?Boolean

Returns:

  • (Boolean)


33
# File 'lib/phlex/reactive/doctor.rb', line 33

def ok? = status == :ok

#unknown?Boolean

Returns:

  • (Boolean)


35
# File 'lib/phlex/reactive/doctor.rb', line 35

def unknown? = status == :unknown