Class: Igniter::Extensions::Contracts::Debug::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/igniter/extensions/contracts/debug/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(profile_snapshot:, compilation_report: nil, execution_result: nil, diagnostics_report: nil, provenance_summary: nil) ⇒ Report

Returns a new instance of Report.



16
17
18
19
20
21
22
23
24
# File 'lib/igniter/extensions/contracts/debug/report.rb', line 16

def initialize(profile_snapshot:, compilation_report: nil, execution_result: nil, diagnostics_report: nil,
               provenance_summary: nil)
  @profile_snapshot = profile_snapshot
  @compilation_report = compilation_report
  @execution_result = execution_result
  @diagnostics_report = diagnostics_report
  @provenance_summary = provenance_summary
  freeze
end

Instance Attribute Details

#compilation_reportObject (readonly)

Returns the value of attribute compilation_report.



10
11
12
# File 'lib/igniter/extensions/contracts/debug/report.rb', line 10

def compilation_report
  @compilation_report
end

#diagnostics_reportObject (readonly)

Returns the value of attribute diagnostics_report.



10
11
12
# File 'lib/igniter/extensions/contracts/debug/report.rb', line 10

def diagnostics_report
  @diagnostics_report
end

#execution_resultObject (readonly)

Returns the value of attribute execution_result.



10
11
12
# File 'lib/igniter/extensions/contracts/debug/report.rb', line 10

def execution_result
  @execution_result
end

#profile_snapshotObject (readonly)

Returns the value of attribute profile_snapshot.



10
11
12
# File 'lib/igniter/extensions/contracts/debug/report.rb', line 10

def profile_snapshot
  @profile_snapshot
end

#provenance_summaryObject (readonly)

Returns the value of attribute provenance_summary.



10
11
12
# File 'lib/igniter/extensions/contracts/debug/report.rb', line 10

def provenance_summary
  @provenance_summary
end

Instance Method Details

#invalid?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/igniter/extensions/contracts/debug/report.rb', line 30

def invalid?
  !ok?
end

#ok?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/igniter/extensions/contracts/debug/report.rb', line 26

def ok?
  compilation_report.nil? || compilation_report.ok?
end

#to_hObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/igniter/extensions/contracts/debug/report.rb', line 34

def to_h
  payload = {
    profile: profile_snapshot.to_h,
    ok: ok?
  }

  payload[:compilation] = compilation_report.to_h if compilation_report
  payload[:execution] = execution_result.to_h if execution_result
  payload[:diagnostics] = diagnostics_report.to_h if diagnostics_report
  payload[:provenance] = provenance_summary if provenance_summary
  payload
end