human_duration 2.0.1 → 2.0.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
  SHA256:
3
- metadata.gz: a07b1128d2076150c725dd67ac13424c01e0c386bc6039cf5742ba6dfd93d28c
4
- data.tar.gz: f4dba21c426dc68a6047f7bb627f0dcd26f814fd4ade0094dd981b84f7c46844
3
+ metadata.gz: 35a2dd7577c089777d6435ea8b027d8e3fe68fe70458736db2142e10a108e665
4
+ data.tar.gz: 9a5f19a3444966f689afa7dc3bc3e44644545d5dab613b17c16609bdbec7488d
5
5
  SHA512:
6
- metadata.gz: 88db2bbb9c749df6d86e3559fbab2bf74a142ae92a220777626f1704c685d105582f36b7cad7d0cffdc10f6e5e99e9d14921273735f78e73755ef101acc7f161
7
- data.tar.gz: 29ebd57cebaf408fc80fad75da66068b9684bbf4701a0e059c24860231450a19760faefaf93799e77f70e91d662d4a88ee269571aae22bf9cf8ecadc1fc5b7d5
6
+ metadata.gz: 911fbe7d6c4daa436e8c59846b8e6127716ca631a915bc81d210f3d51fe73d940a00142fc54409c0ccf6ebc42770aa2489175cb8e240a053dfe28d57cea19473
7
+ data.tar.gz: f382c53f0bb81817bdcc331347de0dd944996b6189bef31c98af7debf2709906078833c4401716df56a0d019072f4950cabce659ce845d04a34776269977ee14
@@ -1,23 +1,27 @@
1
- sudo: required
2
1
  matrix:
3
2
  include:
4
3
  - language: ruby
4
+ name: "Bundler (rvm 2.4.4 & bundler 1.17.3)"
5
5
  rvm: 2.4.4
6
6
  before_install:
7
7
  - gem install bundler -v 1.17.3
8
8
  - language: ruby
9
+ name: "Bundler (rvm 2.4.4 & bundler 2.0.1)"
9
10
  rvm: 2.4.4
10
11
  before_install:
11
12
  - gem install bundler -v 2.0.1
12
13
  - language: ruby
14
+ name: "Bundler (rvm 2.5.3 & bundler 2.0.1)"
13
15
  rvm: 2.5.3
14
16
  before_install:
15
17
  - gem install bundler -v 2.0.1
16
18
  - language: ruby
19
+ name: "Bundler (rvm 2.6.1 & bundler 2.0.1)"
17
20
  rvm: 2.6.1
18
21
  before_install:
19
22
  - gem install bundler -v 2.0.1
20
23
  - language: ruby
24
+ name: "Rubocop (rvm 2.4.4)"
21
25
  env: SKIP_INTERPRETER=true
22
26
  rvm: 2.4.4
23
27
  before_install:
@@ -27,6 +31,7 @@ matrix:
27
31
  script:
28
32
  - ./rubocop-travis/scan.sh
29
33
  - language: ruby
34
+ name: "Rubocop (rvm 2.5.3)"
30
35
  env: SKIP_INTERPRETER=true
31
36
  rvm: 2.5.3
32
37
  before_install:
@@ -36,6 +41,7 @@ matrix:
36
41
  script:
37
42
  - ./rubocop-travis/scan.sh
38
43
  - language: ruby
44
+ name: "Rubocop (rvm 2.6.1)"
39
45
  env: SKIP_INTERPRETER=true
40
46
  rvm: 2.6.1
41
47
  before_install:
@@ -45,6 +51,7 @@ matrix:
45
51
  script:
46
52
  - ./rubocop-travis/scan.sh
47
53
  - language: ruby
54
+ name: "Link Checker (rvm 2.6.1)"
48
55
  rvm: 2.6.1
49
56
  before_install:
50
57
  - mkdir travis
@@ -1,3 +1,9 @@
1
+ ## 2.0.2 (June 28, 2019)
2
+
3
+ IMPROVEMENTS:
4
+
5
+ * Clean up tweaks based on updates to rubocop. ([@TGWolf][])
6
+
1
7
  ## 2.0.1 (March 13, 2019)
2
8
 
3
9
  IMPROVEMENTS:
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'human_duration'
4
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'human_duration/constants'
2
4
  require_relative 'human_duration/overloads'
3
5
  require_relative 'human_duration/version'
@@ -25,7 +27,7 @@ module HumanDuration
25
27
  def self.human_duration(seconds)
26
28
  reset
27
29
 
28
- return 'negative' if seconds < 0
30
+ return 'negative' if seconds.negative?
29
31
  return 'now' if seconds.zero?
30
32
 
31
33
  split_seconds(seconds)
@@ -58,18 +60,18 @@ module HumanDuration
58
60
  def self.add_time(value, name, plural = true)
59
61
  return if value < 1 && $type != 'full'
60
62
 
61
- $output_buffer << if plural
63
+ $output_buffer += if plural
62
64
  format('%<value>s %<name>s%<plural>s', value: value, name: name, plural: pluralize(value))
63
65
  else
64
66
  format('%<value>s %<name>s', value: value, name: name)
65
67
  end
66
68
  $item_count -= 1
67
- $output_buffer << comma_or_not($item_count)
69
+ $output_buffer += comma_or_not($item_count)
68
70
  end
69
71
 
70
72
  def self.split_seconds(seconds)
71
73
  SPLIT_TYPES.map do |count, name|
72
- if seconds > 0
74
+ if seconds.positive?
73
75
  seconds, n = seconds.divmod(count)
74
76
  $time_values[name] = n
75
77
  else
@@ -80,7 +82,7 @@ module HumanDuration
80
82
 
81
83
  def self.count_items
82
84
  $time_values.each do |_name, value|
83
- $item_count += 1 if value > 0 || $type == 'full'
85
+ $item_count += 1 if value.positive? || $type == 'full'
84
86
  end
85
87
  end
86
88
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HumanDuration
2
4
  SPLIT_TYPES = [[60, 'second'], [60, 'minute'], [24, 'hour'], [365, 'day'], [1000, 'year']].freeze
3
5
  SHORT_NAME_MAP = { 'second' => 's', 'minute' => 'm', 'hour' => 'h', 'day' => 'd', 'year' => 'y' }.freeze
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Overload the integer class
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HumanDuration
2
- VERSION = '2.0.1'.freeze
4
+ VERSION = '2.0.2'
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # rubocop:disable Metrics/BlockLength
2
4
 
3
5
  require 'human_duration'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'human_duration'
3
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: human_duration
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Gurney aka Wolf
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-13 00:00:00.000000000 Z
11
+ date: 2019-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler