bar-of-progress 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4e60372a78682438217bb7b7568a84de5f2e24d
4
- data.tar.gz: 5edf32dbd4518fe1b4da85353b047c7380e1512b
3
+ metadata.gz: ee0a9586bd4a588c64c731b1a7daf07d32015fc5
4
+ data.tar.gz: 19bb56d81c444a8392b847576501cd98981d7b2d
5
5
  SHA512:
6
- metadata.gz: 1e68553503a3d9df8c8dad7e853588ae8dc8211b7527a2c1b0d5e8d8a34733009adae2c115073fa584c7a85f2c64446fdd36b871f4b9cb7f84c4a8d199acb3a2
7
- data.tar.gz: 55a24fa8675e6298ea52c68261f26d2314ee75ce9928d00dba118aa2932a11989ebabd2dfe0131473c4dd30bd901fd5bc86109f40c179d90f680bd2ad34b15ed
6
+ metadata.gz: 7dcd0ef35a006ab61416e7dae643bf03d570ae9131b5ef6bedd73060b3cefe981773d835d969aca82c51003bd5f69675d8aaf522d082ae40430e0bfcec199d78
7
+ data.tar.gz: 7c2aa02ac6127adea032a40c8596d4902ade6897b3cc1176c2f15555d24013c40fd6c2cd5eb3a764426e38e4273291f707159a0fc18bc03f4616aeb439399436
data/.travis.yml CHANGED
@@ -3,4 +3,5 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
5
  - 2.1.1
6
+ before_install: gem install bundler
6
7
  script: bundle exec rspec
@@ -3,7 +3,6 @@
3
3
  require "bar_of_progress/version"
4
4
 
5
5
  require 'bigdecimal'
6
- require 'bigdecimal/util'
7
6
 
8
7
  class BarOfProgress
9
8
  DEFAULTS = {
@@ -20,7 +19,7 @@ class BarOfProgress
20
19
  @options = DEFAULTS.merge(options)
21
20
 
22
21
  #massage data because eww.
23
- @options[:total] = @options[:total].to_d
22
+ @options[:total] = to_d(@options[:total])
24
23
  @options[:length] = @options[:length].to_i
25
24
  end
26
25
 
@@ -32,7 +31,7 @@ class BarOfProgress
32
31
  private
33
32
 
34
33
  def clamped_bubbles_for(amount)
35
- clamp(bubbles_for(amount), 0, @options[:length]).to_d
34
+ to_d(clamp(bubbles_for(amount), 0, @options[:length]))
36
35
  end
37
36
 
38
37
  def partial_bubbles_for(bubbles)
@@ -40,7 +39,7 @@ private
40
39
  end
41
40
 
42
41
  def bubbles_for(amount)
43
- (amount.to_d / @options[:total]) * @options[:length]
42
+ (to_d(amount) / @options[:total]) * @options[:length]
44
43
  end
45
44
 
46
45
  # This method is amazing.
@@ -48,6 +47,14 @@ private
48
47
  [[n, min].max, max].min
49
48
  end
50
49
 
50
+ def to_d(thing)
51
+ if thing.kind_of?(Float)
52
+ BigDecimal(thing, Float::DIG)
53
+ else
54
+ BigDecimal(thing)
55
+ end
56
+ end
57
+
51
58
  class Output
52
59
  def initialize(complete, partial, options)
53
60
  @complete = complete
@@ -1,3 +1,3 @@
1
1
  class BarOfProgress
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bar-of-progress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-21 00:00:00.000000000 Z
11
+ date: 2016-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Render custom textual progress bars with a simple little API
@@ -45,9 +45,9 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
49
- - .rspec
50
- - .travis.yml
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".travis.yml"
51
51
  - Gemfile
52
52
  - LICENSE.txt
53
53
  - README.md
@@ -67,17 +67,17 @@ require_paths:
67
67
  - lib
68
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - '>='
70
+ - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.3.0
80
+ rubygems_version: 2.5.1
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: Render custom textual progress bars