duration-formatter 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a39c32b6b33eb9cbceb2217076d2885c6cccc9d3
4
- data.tar.gz: 605b7729fd220eb86475942fc703efb2fa57242a
3
+ metadata.gz: 507104638a4a8b8cf7adb5692c352c021a33275a
4
+ data.tar.gz: 7f95937db867be224021df525f7b5c2eef7490c5
5
5
  SHA512:
6
- metadata.gz: 8959c57e5da03f7042907d9fc88fb30aca4ca26185839c39b27cac9c212f052aca70b98f420ae8919a3bcf734a78c4808a2d621b8d9488afc668de359de0222b
7
- data.tar.gz: 246a2fc74441bdf3e6ef0b5b6c116e3d05867484bad1326135130acef7089fe441cba4323da5822b5be3d72bf1b1f1653b682ba8bcfce39f09058959615d52df
6
+ metadata.gz: ed666090e24594bbb499ce93e2fd000f24950c5e50a8f0de22d37163f37892471936e01257f49dd5a48bbb4cb9b2cab290a9a6e25c62696b5fad82ce6dc9ec85
7
+ data.tar.gz: 5ea244b725e9334b8af6501122a6b9f42bfd6804b88081873aeedb2a9d8b12cab26142ac5f82ee1c66c4b3b01986ece413d7e7dbd0b7e7660d3e49401338f201
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- duration-formatter (1.0.0)
4
+ duration-formatter (1.0.1)
5
5
  ruby-duration (~> 3.2)
6
6
 
7
7
  GEM
Binary file
@@ -1,3 +1,3 @@
1
1
  module DurationFormatter
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -22,22 +22,22 @@ class FormattedDuration
22
22
  output << Duration.new(weeks: @weeks).format('%w %~w')
23
23
  end
24
24
 
25
- if weekless_days != 0 && @constraint > 1
26
- output << Duration.new(days: weekless_days).format('%d %~d')
27
- elsif @days > 0 && @constraint == 2
25
+ if @days > 0 && @constraint == 2
28
26
  output << Duration.new(days: @days).format('%tdu')
27
+ elsif weekless_days != 0 && @constraint > 1
28
+ output << Duration.new(days: weekless_days).format('%d %~d')
29
29
  end
30
30
 
31
- if dayless_hours != 0 && @constraint > 0
32
- output << Duration.new(hours: dayless_hours).format('%h %~h')
33
- elsif @hours > 0 && @constraint == 1
31
+ if @hours > 0 && @constraint == 1
34
32
  output << Duration.new(hours: @hours).format('%thu')
33
+ elsif dayless_hours != 0 && @constraint > 0
34
+ output << Duration.new(hours: dayless_hours).format('%h %~h')
35
35
  end
36
36
 
37
- if hourless_minutes != 0
38
- output << Duration.new(minutes: hourless_minutes).format('%m %~m')
39
- elsif @minutes > 0 && @constraint == 0
37
+ if @minutes > 0 && @constraint == 0
40
38
  output << Duration.new(minutes: @minutes).format('%tmu')
39
+ elsif hourless_minutes != 0
40
+ output << Duration.new(minutes: hourless_minutes).format('%m %~m')
41
41
  end
42
42
 
43
43
  output.join(', ')
@@ -58,8 +58,8 @@ class FormattedDurationTest < Minitest::Test
58
58
  # Constraints
59
59
 
60
60
  def test_days_constraint
61
- text = '7 days'
62
- output = FormattedDuration.new(10080, :days).format
61
+ text = '8 days'
62
+ output = FormattedDuration.new(11520, :days).format
63
63
 
64
64
  assert_equal text, output
65
65
  end
@@ -72,8 +72,8 @@ class FormattedDurationTest < Minitest::Test
72
72
  end
73
73
 
74
74
  def test_minutes_constraint
75
- text = '60 minutes'
76
- output = FormattedDuration.new(60, :minutes).format
75
+ text = '80 minutes'
76
+ output = FormattedDuration.new(80, :minutes).format
77
77
 
78
78
  assert_equal text, output
79
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duration-formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Venneman
@@ -95,6 +95,7 @@ files:
95
95
  - Guardfile
96
96
  - README.md
97
97
  - Rakefile
98
+ - duration-formatter-1.0.0.gem
98
99
  - duration-formatter.gemspec
99
100
  - lib/duration-formatter.rb
100
101
  - lib/duration_formatter/version.rb