Class: Jade::Diagnostics::Diagnostic

Inherits:
Data
  • Object
show all
Defined in:
lib/jade/diagnostics.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations

Returns:

  • (Object)

    the current value of annotations



8
9
10
# File 'lib/jade/diagnostics.rb', line 8

def annotations
  @annotations
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



8
9
10
# File 'lib/jade/diagnostics.rb', line 8

def message
  @message
end

#primaryObject (readonly)

Returns the value of attribute primary

Returns:

  • (Object)

    the current value of primary



8
9
10
# File 'lib/jade/diagnostics.rb', line 8

def primary
  @primary
end

#secondaryObject (readonly)

Returns the value of attribute secondary

Returns:

  • (Object)

    the current value of secondary



8
9
10
# File 'lib/jade/diagnostics.rb', line 8

def secondary
  @secondary
end

#severityObject (readonly)

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



8
9
10
# File 'lib/jade/diagnostics.rb', line 8

def severity
  @severity
end

Class Method Details

.error(message, primary:, secondary: [], annotations: []) ⇒ Object



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

def self.error(message, primary:, secondary: [], annotations: [])
  new(severity: :error, message:, primary:, secondary:, annotations:)
end

.warning(message, primary:, secondary: [], annotations: []) ⇒ Object



13
14
15
# File 'lib/jade/diagnostics.rb', line 13

def self.warning(message, primary:, secondary: [], annotations: [])
  new(severity: :warning, message:, primary:, secondary:, annotations:)
end

Instance Method Details

#annotate(kind, text) ⇒ Object



21
22
23
# File 'lib/jade/diagnostics.rb', line 21

def annotate(kind, text)
  with(annotations: annotations + [Annotation[kind, text]])
end

#error?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/jade/diagnostics.rb', line 17

def error?
  severity == :error
end