class Bcome::LoadingBar::Indicator::Base
Constants
- CHARACTERS
- SIGNAL_FAILURE
- SIGNAL_STOP
- SIGNAL_SUCCESS
Public Class Methods
new(config = {})
click to toggle source
# 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
Public Instance Methods
increment_failure()
click to toggle source
# File lib/objects/loading_bar/indicator/base.rb, line 40 def increment_failure raise 'Should be overidden' end
increment_success()
click to toggle source
# File lib/objects/loading_bar/indicator/base.rb, line 36 def increment_success raise 'Should be overidden' end
indicate()
click to toggle source
# File lib/objects/loading_bar/indicator/base.rb, line 23 def indicate print "\n" loop do increment sleep 0.1 show end end
show()
click to toggle source
# File lib/objects/loading_bar/indicator/base.rb, line 32 def show raise 'Should be overidden' end
Private Instance Methods
completed_cycle?()
click to toggle source
# File lib/objects/loading_bar/indicator/base.rb, line 51 def completed_cycle? @current_character == CHARACTERS.length end
glyph()
click to toggle source
# File lib/objects/loading_bar/indicator/base.rb, line 59 def glyph CHARACTERS[@current_character] end
increment()
click to toggle source
# File lib/objects/loading_bar/indicator/base.rb, line 46 def increment @current_character += 1 @current_character = 0 if completed_cycle? end
progressed_glyph()
click to toggle source
# File lib/objects/loading_bar/indicator/base.rb, line 55 def progressed_glyph CHARACTERS[0] end