Class: Flexr::Diagnostic

Inherits:
Struct
  • Object
show all
Defined in:
lib/flexr/diagnostics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



4
5
6
# File 'lib/flexr/diagnostics.rb', line 4

def code
  @code
end

#helpObject

Returns the value of attribute help

Returns:

  • (Object)

    the current value of help



4
5
6
# File 'lib/flexr/diagnostics.rb', line 4

def help
  @help
end

#locationObject

Returns the value of attribute location

Returns:

  • (Object)

    the current value of location



4
5
6
# File 'lib/flexr/diagnostics.rb', line 4

def location
  @location
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



4
5
6
# File 'lib/flexr/diagnostics.rb', line 4

def message
  @message
end

#noteObject

Returns the value of attribute note

Returns:

  • (Object)

    the current value of note



4
5
6
# File 'lib/flexr/diagnostics.rb', line 4

def note
  @note
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



4
5
6
# File 'lib/flexr/diagnostics.rb', line 4

def severity
  @severity
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/flexr/diagnostics.rb', line 5

def error?
  severity == :error
end

#to_hObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/flexr/diagnostics.rb', line 13

def to_h
  {
    code: code,
    severity: severity,
    message: message,
    location: location,
    help: help,
    note: note
  }.compact
end

#warning?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/flexr/diagnostics.rb', line 9

def warning?
  severity == :warning
end