Class: SoundCloud::Downloader::Helpers

Inherits:
Object
  • Object
show all
Defined in:
lib/soundcloud-downloader.rb

Class Method Summary collapse

Class Method Details

.progress_bar(char, end_char, position) ⇒ Object

Public: Displays a progress bar

char - A unique Character, respresenting the progress in the progress bar. end_char - A unique Character, showed on the end of the progress bar. position - A Number, the current position.

Examples:

  SoundCloud::Downloader::Helpers.progress_bar('=', '>', 5)
  # =====>
  SoundCloud::Downloader::Helpers.progress_bar('=', '>', 10)
  # ==========>


32
33
34
35
# File 'lib/soundcloud-downloader.rb', line 32

def self.progress_bar(char, end_char, position)
  print "\r\e[0K" + (char * position) + end_char
  $stdout.flush
end