Class: CleoQualityReview::RunArtifacts::RawCheckOutputs::Record

Inherits:
Struct
  • Object
show all
Defined in:
lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb

Overview

Raw output content and metadata for one quality check.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#check_nameObject

Returns the value of attribute check_name

Returns:

  • (Object)

    the current value of check_name



12
13
14
# File 'lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb', line 12

def check_name
  @check_name
end

#extensionObject

Returns the value of attribute extension

Returns:

  • (Object)

    the current value of extension



12
13
14
# File 'lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb', line 12

def extension
  @extension
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



12
13
14
# File 'lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb', line 12

def path
  @path
end

#raw_outputObject

Returns the value of attribute raw_output

Returns:

  • (Object)

    the current value of raw_output



12
13
14
# File 'lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb', line 12

def raw_output
  @raw_output
end

#tool_nameObject

Returns the value of attribute tool_name

Returns:

  • (Object)

    the current value of tool_name



12
13
14
# File 'lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb', line 12

def tool_name
  @tool_name
end

#tool_typeObject

Returns the value of attribute tool_type

Returns:

  • (Object)

    the current value of tool_type



12
13
14
# File 'lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb', line 12

def tool_type
  @tool_type
end

Class Method Details

.from_path(filepath:, check_name:, tool_type:) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb', line 13

def self.from_path(filepath:, check_name:, tool_type:)
  new(
    check_name: check_name,
    tool_name: check_name,
    tool_type: tool_type,
    extension: File.extname(filepath).delete_prefix("."),
    path: filepath,
    raw_output: File.read(filepath, invalid: :replace, undef: :replace),
  )
end

Instance Method Details

#to_hObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb', line 32

def to_h
  {
    check_name: check_name,
    tool_name: tool_name,
    tool_type: tool_type,
    extension: extension,
    path: path,
    raw_output: raw_output,
  }.compact
end

#to_pairObject



24
25
26
# File 'lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb', line 24

def to_pair
  [check_name, raw_output]
end

#to_record_pairObject



28
29
30
# File 'lib/cleo_quality_review/run_artifacts/raw_check_outputs.rb', line 28

def to_record_pair
  [check_name, self]
end