Method: BaseChip::Reporting::Methods#message

Defined in:
lib/reporting.rb

#message(type, msg, color = nil) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/reporting.rb', line 71

def message(type,msg,color = nil)
  clear_line if self.respond_to? :clear_line
  ostring = case color
            when :red   ; ""
            when :green ; ""
            when nil    ; ''
            else raise
            end
  msg.chomp!
  if msg =~ /\n/
    ostring += "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
    ostring += "+++++ #{type}: (Multi-line) +++++++++++++++++++++++++++++++++++++++\n"
    ostring += "#{msg}\n"
    ostring += "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
  else
    ostring += "#{type}: #{msg}"
  end
  ostring += "" if color
  puts ostring
  ostring
end