Class: AsciiChem::Linter::Diagnostic

Inherits:
Struct
  • Object
show all
Defined in:
lib/asciichem/linter/diagnostic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



5
6
7
# File 'lib/asciichem/linter/diagnostic.rb', line 5

def message
  @message
end

#nodeObject

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node



5
6
7
# File 'lib/asciichem/linter/diagnostic.rb', line 5

def node
  @node
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



5
6
7
# File 'lib/asciichem/linter/diagnostic.rb', line 5

def severity
  @severity
end

Instance Method Details

#to_sObject



6
7
8
9
10
11
12
13
# File 'lib/asciichem/linter/diagnostic.rb', line 6

def to_s
  context = node&.diagnostic_label
  if context
    "[#{severity}] #{context}: #{message}"
  else
    "[#{severity}] #{message}"
  end
end