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.



192
193
194
195
196
197
198
199
200
# File 'lib/graphomaton/model.rb', line 192

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

#code ⇒ Object (readonly)

Returns the value of attribute code

Returns:

  • (Object) —

    the current value of code



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

def code
  @code
end

#hint ⇒ Object (readonly)

Returns the value of attribute hint

Returns:

  • (Object) —

    the current value of hint



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

def hint
  @hint
end

#message ⇒ Object (readonly)

Returns the value of attribute message

Returns:

  • (Object) —

    the current value of message



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

def message
  @message
end

#path ⇒ Object (readonly)

Returns the value of attribute path

Returns:

  • (Object) —

    the current value of path



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

def path
  @path
end

#severity ⇒ Object (readonly)

Returns the value of attribute severity

Returns:

  • (Object) —

    the current value of severity



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

def severity
  @severity
end

Instance Method Details

#to_h ⇒ Hash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


202
203
204
# File 'lib/graphomaton/model.rb', line 202

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