progress 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.0.5 2008-11-07
2
+
3
+ * piping result of block execution
4
+ * changed default step count to 1 (from 100)
5
+
1
6
  == 0.0.4 2008-11-06
2
7
 
3
8
  * step now accept count of steps made
data/lib/progress.rb CHANGED
@@ -4,7 +4,7 @@ $:.unshift(File.dirname(__FILE__)) unless
4
4
  require 'singleton'
5
5
 
6
6
  class Progress
7
- VERSION = '0.0.4'
7
+ VERSION = '0.0.5'
8
8
 
9
9
  include Singleton
10
10
 
@@ -29,12 +29,13 @@ class Progress
29
29
  # sleep(0.001)
30
30
  # end
31
31
  # end
32
- def self.start(name, total = 100)
32
+ def self.start(name, total = 1)
33
33
  levels << new(name, total, levels.length)
34
34
  print_message
35
35
  if block_given?
36
- yield
36
+ result = yield
37
37
  stop
38
+ result
38
39
  end
39
40
  end
40
41
 
@@ -111,4 +111,10 @@ describe Progress do
111
111
  end
112
112
  io_pop.should =~ /100\.0.*\n$/
113
113
  end
114
+
115
+ it "should pipe result from block" do
116
+ Progress.start('Test') do
117
+ 'qwerty'
118
+ end.should == 'qwerty'
119
+ end
114
120
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: progress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - toy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-06 00:00:00 +03:00
12
+ date: 2008-11-07 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency