indicator 0.1.2 → 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.
data/README.rdoc CHANGED
@@ -63,3 +63,32 @@ UNICODE extra sets: :arrows :box :braile
63
63
  sleep 0.5
64
64
  end
65
65
  end
66
+
67
+ =Advanced usage
68
+ ===Using count
69
+ Use int method to increment percent
70
+
71
+ Indicator::spin :count => 10 do |spin|
72
+ 10.times do
73
+ spin.inc
74
+ sleep 0.2
75
+ end
76
+ end
77
+
78
+ ===Using count, pre-text and post-text
79
+ Indicator::spin :pre => "Work", :frames => [' ', '. ', '.. ', '...'], :count => 10, :post => ' in progress' do |spin|
80
+ 10.times do
81
+ spin.inc
82
+ sleep 0.2
83
+ end
84
+ end
85
+
86
+ ===Change post-text
87
+ Indicator::spin :pre => "Work", :frames => [' ', '. ', '.. ', '...'], :count => 10 do |spin|
88
+ 10.times do |i|
89
+ spin.inc
90
+ spin.post= " in progress #{i} of 10"
91
+ sleep 0.2
92
+ end
93
+ end
94
+
@@ -30,7 +30,7 @@ module Indicator
30
30
  def spin
31
31
  clean
32
32
  build
33
- printf @spin
33
+ print @spin
34
34
  end
35
35
 
36
36
  def clean
@@ -42,7 +42,7 @@ module Indicator
42
42
  @spin = @pre
43
43
  @spin += @frames[0]
44
44
  @frames.push @frames.shift
45
- @spin += sprintf(" %3.2f%%", @count * 100.0 / @current) if @count
45
+ @spin += sprintf(" %3.2f%", @current * 100.0 / @count) if @count
46
46
  @spin += @post
47
47
  end
48
48
 
@@ -1,3 +1,3 @@
1
1
  module Indicator
2
- VERSION = "0.1.2"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indicator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-05 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &14306040 !ruby/object:Gem::Requirement
16
+ requirement: &10917440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 2.7.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *14306040
24
+ version_requirements: *10917440
25
25
  description: Sometimes you need to display activity on the text console to inform
26
26
  the user that the program is actually doing something. Be funny with a lot predefined
27
27
  sets or make you own widget to display an animation text during a long-running process