Class: Hospital::Diagnosis::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/hospital/diagnosis.rb

Direct Known Subclasses

Error, Info, Skip, Warning

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Result

Returns a new instance of Result.



56
57
58
# File 'lib/hospital/diagnosis.rb', line 56

def initialize message
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



54
55
56
# File 'lib/hospital/diagnosis.rb', line 54

def message
  @message
end

#prefixObject (readonly)

Returns the value of attribute prefix.



54
55
56
# File 'lib/hospital/diagnosis.rb', line 54

def prefix
  @prefix
end

Instance Method Details

#outputObject



60
61
62
# File 'lib/hospital/diagnosis.rb', line 60

def output
  "#{prefix} #{message.gsub(/\n\z/, '').gsub(/\n/, prefix ? "\n   " : "\n")}"
end

#put(out) ⇒ Object



64
65
66
# File 'lib/hospital/diagnosis.rb', line 64

def put out
  out.put_diagnosis_result output
end