Class: Pindo::Funlog
- Inherits:
-
Object
- Object
- Pindo::Funlog
- Defined in:
- lib/pindo/base/funlog.rb
Defined Under Namespace
Modules: Mixin
Singleton collapse
Singleton collapse
-
.reload_instance ⇒ Config
The current config instance creating one if needed.
Instance Method Summary collapse
- #create_spinner(info_key: nil) ⇒ Object
- #fancyinfo_error(*args) ⇒ Object
- #fancyinfo_start(*args) ⇒ Object
- #fancyinfo_success(*args) ⇒ Object
- #fancyinfo_update(*args) ⇒ Object
- #spinner_log_handle ⇒ Object
Class Attribute Details
.instance ⇒ Object
62 63 64 |
# File 'lib/pindo/base/funlog.rb', line 62 def self.instance @instance ||= new end |
Class Method Details
.reload_instance ⇒ Config
Returns the current config instance creating one if needed.
58 59 60 |
# File 'lib/pindo/base/funlog.rb', line 58 def self.reload_instance @instance = new end |
Instance Method Details
#create_spinner(info_key: nil) ⇒ Object
8 9 10 11 12 |
# File 'lib/pindo/base/funlog.rb', line 8 def create_spinner(info_key:nil) # spinner = TTY::Spinner.new("[:spinner] :#{info_key}", format: :dots_2, error_mark: "❌", success_mark: "✅") spinner = TTY::Spinner.new("[:spinner] :#{info_key}", format: :dots_2, error_mark: "❌") spinner end |
#fancyinfo_error(*args) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/pindo/base/funlog.rb', line 45 def (*args) = args.join(" ") spinner_log_handle.update(title:) spinner_log_handle.error @spinner_log =nil end |
#fancyinfo_start(*args) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/pindo/base/funlog.rb', line 23 def (*args) = args.join(" ") spinner_log_handle.update(title:) spinner_log_handle.auto_spin @spinner_log end |
#fancyinfo_success(*args) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/pindo/base/funlog.rb', line 38 def (*args) = args.join(" ") spinner_log_handle.update(title:) spinner_log_handle.success @spinner_log =nil end |
#fancyinfo_update(*args) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/pindo/base/funlog.rb', line 31 def (*args) = args.join(" ") spinner_log_handle.update(title:) spinner_log_handle.spin @spinner_log end |
#spinner_log_handle ⇒ Object
14 15 16 17 18 19 |
# File 'lib/pindo/base/funlog.rb', line 14 def spinner_log_handle if @spinner_log.nil? @spinner_log = create_spinner(info_key:"title") end @spinner_log end |