Class: Bcome::LoadingBar::Indicator::Base
- Inherits:
-
Object
- Object
- Bcome::LoadingBar::Indicator::Base
- Defined in:
- lib/objects/loading_bar/indicator/base.rb
Constant Summary collapse
- CHARACTERS =
%w[⣾ ⣷ ⣯ ⣟ ⡿ ⢿ ⣻ ⣽].freeze
- SIGNAL_SUCCESS =
'USR1'
- SIGNAL_FAILURE =
'USR2'
- SIGNAL_STOP =
'SIGKILL'
Instance Method Summary collapse
- #increment_failure ⇒ Object
- #increment_success ⇒ Object
- #indicate ⇒ Object
-
#initialize(config = {}) ⇒ Base
constructor
A new instance of Base.
- #show ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Base
Returns a new instance of Base.
13 14 15 16 17 18 19 20 21 |
# File 'lib/objects/loading_bar/indicator/base.rb', line 13 def initialize(config = {}) @progress_size = config[:size] @title = config[:title] @completed_title = config[:completed_title] @current_character = 0 @progression = '' @results = [] end |
Instance Method Details
#increment_failure ⇒ Object
40 41 42 |
# File 'lib/objects/loading_bar/indicator/base.rb', line 40 def increment_failure raise 'Should be overidden' end |
#increment_success ⇒ Object
36 37 38 |
# File 'lib/objects/loading_bar/indicator/base.rb', line 36 def increment_success raise 'Should be overidden' end |
#indicate ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/objects/loading_bar/indicator/base.rb', line 23 def indicate print "\n" loop do increment sleep 0.1 show end end |
#show ⇒ Object
32 33 34 |
# File 'lib/objects/loading_bar/indicator/base.rb', line 32 def show raise 'Should be overidden' end |