File: progress_with_options.rb

package info (click to toggle)
ruby-parallel 1.22.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 464 kB
  • sloc: ruby: 1,930; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 647 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true
require './spec/cases/helper'

# ruby-progressbar ignores the format string you give it
# unless the output is a TTY.  When running in the test,
# the output is not a TTY, so we cannot test that the format
# string you pass overrides parallel's default.  So, we pretend
# that stdout is a TTY to test that the options are merged
# in the correct way.
tty_stdout = $stdout
class << tty_stdout
  def tty?
    true
  end
end

parallel_options = {
  progress: {
    title: "Reticulating Splines",
    progress_mark: ';',
    format: "%t %w",
    output: tty_stdout
  }
}

Parallel.map(1..50, parallel_options) do
  2
end