Class: Publisher::Helpers::Spinner
- Inherits:
-
Object
- Object
- Publisher::Helpers::Spinner
- Includes:
- Publisher::Helpers
- Defined in:
- lib/allure_report_publisher/lib/helpers/spinner.rb
Overview
Spinner helper class
Defined Under Namespace
Classes: Failure
Class Method Summary collapse
-
.spin(spinner_message, done_message: "done", exit_on_error: true, debug: false, &block) ⇒ void
Run code block inside spinner.
Instance Method Summary collapse
-
#initialize(spinner_message, exit_on_error: true, debug: false) ⇒ Spinner
constructor
A new instance of Spinner.
-
#spin(done_message = "done") ⇒ Boolean
Run code block inside spinner.
Methods included from Publisher::Helpers
allure_cli?, colorize, debug_io, #env, error, execute_shell, log, log_debug, logger, pastel, path, reset_debug_io!
Constructor Details
#initialize(spinner_message, exit_on_error: true, debug: false) ⇒ Spinner
Returns a new instance of Spinner.
14 15 16 17 18 |
# File 'lib/allure_report_publisher/lib/helpers/spinner.rb', line 14 def initialize(, exit_on_error: true, debug: false) @spinner_message = @exit_on_error = exit_on_error @debug = debug end |
Class Method Details
.spin(spinner_message, done_message: "done", exit_on_error: true, debug: false, &block) ⇒ void
This method returns an undefined value.
Run code block inside spinner
27 28 29 |
# File 'lib/allure_report_publisher/lib/helpers/spinner.rb', line 27 def self.spin(, done_message: "done", exit_on_error: true, debug: false, &block) new(, exit_on_error: exit_on_error, debug: debug).spin(, &block) end |
Instance Method Details
#spin(done_message = "done") ⇒ Boolean
Run code block inside spinner
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/allure_report_publisher/lib/helpers/spinner.rb', line 35 def spin( = "done") spinner.auto_spin yield spinner_success() rescue StandardError => e spinner_error(e) raise(Failure, e.) if exit_on_error ensure print_debug Helpers.reset_debug_io! end |