Class: Desiru::Core::CompilationResult
- Inherits:
-
Object
- Object
- Desiru::Core::CompilationResult
- Defined in:
- lib/desiru/core/compiler.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
-
#program ⇒ Object
readonly
Returns the value of attribute program.
-
#traces ⇒ Object
readonly
Returns the value of attribute traces.
Instance Method Summary collapse
-
#initialize(program:, metrics: {}, traces: [], metadata: {}) ⇒ CompilationResult
constructor
A new instance of CompilationResult.
- #optimization_score ⇒ Object
- #success? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(program:, metrics: {}, traces: [], metadata: {}) ⇒ CompilationResult
Returns a new instance of CompilationResult.
8 9 10 11 12 13 |
# File 'lib/desiru/core/compiler.rb', line 8 def initialize(program:, metrics: {}, traces: [], metadata: {}) @program = program @metrics = metrics @traces = traces = end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/desiru/core/compiler.rb', line 6 def end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
6 7 8 |
# File 'lib/desiru/core/compiler.rb', line 6 def metrics @metrics end |
#program ⇒ Object (readonly)
Returns the value of attribute program.
6 7 8 |
# File 'lib/desiru/core/compiler.rb', line 6 def program @program end |
#traces ⇒ Object (readonly)
Returns the value of attribute traces.
6 7 8 |
# File 'lib/desiru/core/compiler.rb', line 6 def traces @traces end |
Instance Method Details
#optimization_score ⇒ Object
19 20 21 |
# File 'lib/desiru/core/compiler.rb', line 19 def optimization_score @metrics[:optimization_score] || 0.0 end |
#success? ⇒ Boolean
15 16 17 |
# File 'lib/desiru/core/compiler.rb', line 15 def success? [:success] != false end |
#to_h ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/desiru/core/compiler.rb', line 23 def to_h { program: @program.to_h, metrics: @metrics, traces_count: @traces.size, metadata: } end |