jraiman_progressbar 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/lib/jraiman_progressbar.rb +25 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MzY3YjZiMTgyYWZkZTNmM2U5MzFiZjFjYTQwZjM2NDUyZGRjYjY2ZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OTE1M2NhYTAzOGEzZmNmZGQ2YWQ2OTJlZjRiYmFjYTM5YTYwZThkNw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZWI0ZjA4YWEzNWJhZDljMTQ1ZWE3Mjk0MzFlYjNhNmUzZTkwM2NmZmZmMjJh
|
10
|
+
MDE3NjAzYjMwMmVmOWY1MmM5YzVjZDRjMjdmZGU2NTVhNWExZmEzZmJjNDRh
|
11
|
+
MTQwYzVjODNkMTAwMzZkZTY3MzdmZTQ0NmQwODVjODYxNzczYjU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NGZiOWFmN2I1YzNmYzA3YTYyMjVlODlhMDkwMTg2NzMzMmU3OWM1YmJhZDZh
|
14
|
+
N2E5NDNhMTYyZmRkMDUzOTIwMzIyOTdlOGM3OTFlZTU2ZTgzMzFiNjBhNDU1
|
15
|
+
MTRkYzcwYjUyZjZhNDZkZDhjNTA1ZmU3Mjg1MzBiZTUwNzdjMGY=
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# @title Jonathan Raiman's ProgressBar
|
3
|
+
# @author Jonathan Raiman
|
4
|
+
|
5
|
+
module JRProgressBar
|
6
|
+
# Shows a progress bar with a "nacella" format
|
7
|
+
|
8
|
+
# Shows the current position
|
9
|
+
|
10
|
+
# @param pos [Fixnum, Float] the current position in the progress
|
11
|
+
# @param total [Fixnum, Float] the total amount you are advancing towards, so that 100 * pos / total = percent progress.
|
12
|
+
def self.show pos, total
|
13
|
+
if pos > total then total = pos end
|
14
|
+
progress_bar_size = 65
|
15
|
+
nacella_position = ((pos.to_f/total.to_f)* progress_bar_size).floor-2
|
16
|
+
percentage = "#{((pos.to_f/total.to_f)*100).floor}%"
|
17
|
+
percentage.length < 3 ? percentage = " "+percentage : ""
|
18
|
+
nacella_top = (nacella_position > 0 ? (" "*nacella_position) : "")+"┌───┐"
|
19
|
+
nacella_middle = (nacella_position > 0 ? (" "*nacella_position) : "")+"│#{percentage}│"
|
20
|
+
nacella_bottom = nacella_position == -1 ? "└┬──┘" : nacella_position == -2 ? "├───┘" : (" "*nacella_position+"└─┬─┘")
|
21
|
+
progress_bar = "┅"*progress_bar_size
|
22
|
+
progress_bar[nacella_position+2] = "┷"
|
23
|
+
puts ["",nacella_top, nacella_middle, nacella_bottom, progress_bar, ""]
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jraiman_progressbar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jonathan Raiman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A progressbar with a floating percentage value above the bar.
|
14
|
+
email: jraiman@mit.edu
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/jraiman_progressbar.rb
|
20
|
+
homepage: http://github.org/JonathanRaiman/progressbar
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.1.10
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: A progressbar with a floating percentage value above the bar.
|
44
|
+
test_files: []
|
45
|
+
has_rdoc: yard
|