Class: Graphomaton::Diagnostic

Inherits:
Data
  • Object
show all
Defined in:
lib/graphomaton/model.rb,
sig/graphomaton.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, severity:, path:, message:, hint: nil) ⇒ Diagnostic

Returns a new instance of Diagnostic.



180
181
182
183
184
185
186
187
188
# File 'lib/graphomaton/model.rb', line 180

def initialize(code:, severity:, path:, message:, hint: nil)
  super(
    code: ModelValue.copy(code.to_s),
    severity: severity.to_sym,
    path: ModelValue.copy(Array(path)),
    message: ModelValue.copy(message.to_s),
    hint: hint.nil? ? nil : ModelValue.copy(hint.to_s)
  )
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



179
180
181
# File 'lib/graphomaton/model.rb', line 179

def code
  @code
end

#hintObject (readonly)

Returns the value of attribute hint

Returns:

  • (Object)

    the current value of hint



179
180
181
# File 'lib/graphomaton/model.rb', line 179

def hint
  @hint
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



179
180
181
# File 'lib/graphomaton/model.rb', line 179

def message
  @message
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



179
180
181
# File 'lib/graphomaton/model.rb', line 179

def path
  @path
end

#severityObject (readonly)

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



179
180
181
# File 'lib/graphomaton/model.rb', line 179

def severity
  @severity
end

Instance Method Details

#to_hHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


190
191
192
# File 'lib/graphomaton/model.rb', line 190

def to_h
  { code: code, severity: severity, path: path, message: message, hint: hint }.compact
end