Class: EvalRuby::Progress
- Inherits:
-
Struct
- Object
- Struct
- EvalRuby::Progress
- Defined in:
- lib/eval_ruby.rb
Overview
Progress snapshot yielded to the block passed to evaluate_batch.
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
number of samples completed (1-indexed).
-
#total ⇒ Object
readonly
total samples in the batch.
Instance Method Summary collapse
-
#elapsed(value) ⇒ Object
seconds since batch started.
-
#percent ⇒ Float
Completion percentage, 0.0–100.0.
Instance Attribute Details
#current ⇒ Object (readonly)
number of samples completed (1-indexed)
58 59 60 61 62 63 |
# File 'lib/eval_ruby.rb', line 58 Progress = Struct.new(:current, :total, :elapsed, keyword_init: true) do # @return [Float] completion percentage, 0.0–100.0 def percent total.zero? ? 0.0 : (current.to_f / total * 100).round(2) end end |
#total ⇒ Object (readonly)
total samples in the batch
58 59 60 61 62 63 |
# File 'lib/eval_ruby.rb', line 58 Progress = Struct.new(:current, :total, :elapsed, keyword_init: true) do # @return [Float] completion percentage, 0.0–100.0 def percent total.zero? ? 0.0 : (current.to_f / total * 100).round(2) end end |
Instance Method Details
#elapsed=(value) ⇒ Object
seconds since batch started
58 59 60 61 62 63 |
# File 'lib/eval_ruby.rb', line 58 Progress = Struct.new(:current, :total, :elapsed, keyword_init: true) do # @return [Float] completion percentage, 0.0–100.0 def percent total.zero? ? 0.0 : (current.to_f / total * 100).round(2) end end |
#percent ⇒ Float
Returns completion percentage, 0.0–100.0.
60 61 62 |
# File 'lib/eval_ruby.rb', line 60 def percent total.zero? ? 0.0 : (current.to_f / total * 100).round(2) end |