Class: Vastlint::Issue

Inherits:
Object
  • Object
show all
Defined in:
lib/vastlint/issue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, severity:, message:, path:, spec_ref:, line:, col:) ⇒ Issue

Returns a new instance of Issue.



9
10
11
12
13
14
15
16
17
# File 'lib/vastlint/issue.rb', line 9

def initialize(id:, severity:, message:, path:, spec_ref:, line:, col:)
  @id = id
  @severity = severity
  @message = message
  @path = path
  @spec_ref = spec_ref
  @line = line
  @col = col
end

Instance Attribute Details

#colObject (readonly)

Returns the value of attribute col.



7
8
9
# File 'lib/vastlint/issue.rb', line 7

def col
  @col
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/vastlint/issue.rb', line 7

def id
  @id
end

#lineObject (readonly)

Returns the value of attribute line.



7
8
9
# File 'lib/vastlint/issue.rb', line 7

def line
  @line
end

#messageObject (readonly)

Returns the value of attribute message.



7
8
9
# File 'lib/vastlint/issue.rb', line 7

def message
  @message
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/vastlint/issue.rb', line 7

def path
  @path
end

#severityObject (readonly)

Returns the value of attribute severity.



7
8
9
# File 'lib/vastlint/issue.rb', line 7

def severity
  @severity
end

#spec_refObject (readonly)

Returns the value of attribute spec_ref.



7
8
9
# File 'lib/vastlint/issue.rb', line 7

def spec_ref
  @spec_ref
end

Instance Method Details

#as_jsonObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/vastlint/issue.rb', line 19

def as_json(*)
  {
    id: id,
    severity: severity,
    message: message,
    path: path,
    spec_ref: spec_ref,
    line: line,
    col: col
  }
end

#to_hObject



31
32
33
# File 'lib/vastlint/issue.rb', line 31

def to_h
  as_json
end

#to_json(*args) ⇒ Object



35
36
37
# File 'lib/vastlint/issue.rb', line 35

def to_json(*args)
  JSON.generate(as_json, *args)
end