Class: FlutterRb::CheckReport

Inherits:
Object
  • Object
show all
Defined in:
lib/flutter_rb/report/check_report.rb

Overview

Check report

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(check_name, check_report_status, message, path) ⇒ CheckReport

Returns a new instance of CheckReport.

Parameters:

  • check_name (String)
  • check_report_status (CheckReportStatus)
  • message (String)
  • path (String)


12
13
14
15
16
17
# File 'lib/flutter_rb/report/check_report.rb', line 12

def initialize(check_name, check_report_status, message, path)
  @check_name = check_name
  @check_report_status = check_report_status
  @message = message
  @path = path
end

Instance Attribute Details

#check_nameObject (readonly)

Returns the value of attribute check_name.



45
46
47
# File 'lib/flutter_rb/report/check_report.rb', line 45

def check_name
  @check_name
end

#check_report_statusObject (readonly)

Returns the value of attribute check_report_status.



45
46
47
# File 'lib/flutter_rb/report/check_report.rb', line 45

def check_report_status
  @check_report_status
end

#messageObject (readonly)

Returns the value of attribute message.



45
46
47
# File 'lib/flutter_rb/report/check_report.rb', line 45

def message
  @message
end

#pathObject (readonly)

Returns the value of attribute path.



45
46
47
# File 'lib/flutter_rb/report/check_report.rb', line 45

def path
  @path
end

Instance Method Details

#color_for_report_status(check_report_status) ⇒ Presenter

Parameters:

Returns:

  • (Presenter)


32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/flutter_rb/report/check_report.rb', line 32

def color_for_report_status(check_report_status)
  case check_report_status
  when CheckReportStatus::NORMAL
    :green
  when CheckReportStatus::WARNING
    :yellow
  when CheckReportStatus::ERROR
    :red
  else
    :blue
  end
end

Parameters:

  • colorize (Bool) (defaults to: true)

Returns:

  • (String)


21
22
23
24
25
26
27
28
# File 'lib/flutter_rb/report/check_report.rb', line 21

def print(colorize: true)
  if colorize
    status_color = color_for_report_status(@check_report_status)
    " * [#{@check_report_status.colorize(status_color)}] #{@check_name}: #{@message}"
  else
    " * [#{@check_report_status}] #{@check_name}: #{@message}"
  end
end