progress 0.1.0.0 → 0.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/progress.rb +6 -5
  3. data/progress.gemspec +1 -1
  4. metadata +1 -1
data/VERSION.yml CHANGED
@@ -1 +1 @@
1
- [0, 1, 0, 0]
1
+ [0, 1, 0, 1]
data/lib/progress.rb CHANGED
@@ -9,15 +9,16 @@ class Progress
9
9
  module InstanceMethods # :nodoc:
10
10
  attr_accessor :title, :current, :total
11
11
  def initialize(title, total)
12
- @title, @current, @total = title, 0, total.to_f
12
+ total = Float(total)
13
+ @title, @current, @total = title, 0.0, total == 0.0 ? 1.0 : total
13
14
  end
14
15
 
15
16
  def step_if_blank
16
- self.current = 1 if current == 0 && total == 1
17
+ self.current = 1.0 if current == 0.0 && total == 1.0
17
18
  end
18
19
 
19
20
  def to_f(inner)
20
- (current + [inner, 1].min) / total
21
+ (current + (inner < 1.0 ? inner : 1.0)) / total
21
22
  end
22
23
  end
23
24
  include InstanceMethods
@@ -62,12 +63,12 @@ class Progress
62
63
  end
63
64
 
64
65
  def step(steps = 1)
65
- levels.last.current += steps
66
+ levels.last.current += Float(steps)
66
67
  print_message
67
68
  end
68
69
 
69
70
  def set(value)
70
- levels.last.current = value
71
+ levels.last.current = Float(value)
71
72
  print_message
72
73
  end
73
74
 
data/progress.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{progress}
5
- s.version = "0.1.0.0"
5
+ s.version = "0.1.0.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["toy"]
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.1.0.0
4
+ version: 0.1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - toy