time-duration 0.1.3 → 0.1.5

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: edf65ba8a819a75d0ac5a7d8cb629cc25eaee25f1618e36773872e84dfb57fa8
4
- data.tar.gz: 331760d69065cd8ea1325391428b04e5c89043824b6946e69084a02fa6fe75d7
3
+ metadata.gz: fe4a3ed00c2b0d976abc03784b5483fd095b29ccf55c6941b2b42bde1e4d12c4
4
+ data.tar.gz: da82f15e83d225a3a394a3edc2dab31977122a139d9a10cb9dc0e72c518cf564
5
5
  SHA512:
6
- metadata.gz: '08600fc46316fbec77b9fbe531dac3695e877ac899963c496edef30122ef1496173b98ab3c64319e983e5d495734352f6a24d407240bc1667a3fea7c2b03e51a'
7
- data.tar.gz: 52d7233962170be086de18da4429dde694c2d2a9fe93358595760e70904144699bc7d882e42a840491ad0b0e118593a7e9c0d0cb7fc51400f9cd468bd2bcea10
6
+ metadata.gz: d58a50000aac74f44e5f1080e2457241dd8bc1acad524eca86c73a73b49b2bc166299ca98bfda2203926382eb3cdbcbc58a4964d9c1c84e52cc595e78143e16a
7
+ data.tar.gz: 7e0b696cf925382d84a24249315fe60165668e17bd2de76a71f8e254677af16b07a170ebf4afebbdd7b8041a9f6620bfccdf2a1fe3e0cb7d19650220df43d704
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
@@ -0,0 +1,52 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ bump:
7
+ description: "Version bump type"
8
+ required: true
9
+ type: choice
10
+ options:
11
+ - patch
12
+ - minor
13
+ - major
14
+
15
+ permissions:
16
+ contents: write
17
+ id-token: write
18
+
19
+ jobs:
20
+ release:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v6
24
+
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ruby
29
+ bundler-cache: true
30
+
31
+ - name: Install gem-release
32
+ run: gem install gem-release
33
+
34
+ - name: Configure git
35
+ run: |
36
+ git config user.name "github-actions[bot]"
37
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
38
+
39
+ - name: Bump version, commit, tag, push
40
+ id: version
41
+ run: |
42
+ gem bump --version ${{ inputs.bump }} --tag --push
43
+ new=$(ruby -r ./lib/time_duration/version -e 'print TimeDuration::VERSION')
44
+ echo "tag=v${new}" >> "$GITHUB_OUTPUT"
45
+
46
+ - name: Create GitHub Release
47
+ run: gh release create "${{ steps.version.outputs.tag }}" --generate-notes
48
+ env:
49
+ GH_TOKEN: ${{ github.token }}
50
+
51
+ - name: Publish gem to RubyGems
52
+ uses: rubygems/release-gem@v1
@@ -0,0 +1,19 @@
1
+ name: Test
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: ['3.3', '3.4', '4.0']
11
+ steps:
12
+ - uses: actions/checkout@v6
13
+ - name: Set up Ruby
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: ${{ matrix.ruby }}
17
+ bundler-cache: true
18
+ - name: Build and test with Rake
19
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ /Gemfile.lock
2
3
  /.yardoc
3
4
  /_yardoc/
4
5
  /coverage/
@@ -2,7 +2,7 @@ module TimeDuration
2
2
  class Duration
3
3
  include Comparable
4
4
 
5
- attr_accessor :second
5
+ attr_reader :second
6
6
 
7
7
  # TODO: format指定できるようにする
8
8
  def self.parse(time_as_string, format: '%H:%M')
@@ -18,16 +18,16 @@ module TimeDuration
18
18
  end
19
19
 
20
20
  def hour
21
- minute / 60 + second / 3600
21
+ minute / 60 + second.abs / 3600
22
22
  end
23
23
 
24
24
  def minute
25
- (second / 60) % 60
25
+ (second.abs / 60) % 60
26
26
  end
27
27
 
28
28
  # TODO: format指定できるようにする
29
29
  def to_s
30
- "%d:%02d" % [hour, minute]
30
+ "#{'-' if second < 0}%d:%02d" % [hour, minute]
31
31
  end
32
32
 
33
33
  def +(time_duration)
@@ -1,3 +1,3 @@
1
1
  module TimeDuration
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.5'
3
3
  end
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.17"
26
- spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rake", "~> 13.0"
27
26
  spec.add_development_dependency "rspec", "~> 3.0"
28
27
  end
metadata CHANGED
@@ -1,43 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time-duration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daiki Matoba
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2019-06-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.17'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.17'
27
12
  - !ruby/object:Gem::Dependency
28
13
  name: rake
29
14
  requirement: !ruby/object:Gem::Requirement
30
15
  requirements:
31
16
  - - "~>"
32
17
  - !ruby/object:Gem::Version
33
- version: '10.0'
18
+ version: '13.0'
34
19
  type: :development
35
20
  prerelease: false
36
21
  version_requirements: !ruby/object:Gem::Requirement
37
22
  requirements:
38
23
  - - "~>"
39
24
  - !ruby/object:Gem::Version
40
- version: '10.0'
25
+ version: '13.0'
41
26
  - !ruby/object:Gem::Dependency
42
27
  name: rspec
43
28
  requirement: !ruby/object:Gem::Requirement
@@ -59,11 +44,13 @@ executables: []
59
44
  extensions: []
60
45
  extra_rdoc_files: []
61
46
  files:
47
+ - ".github/dependabot.yml"
48
+ - ".github/workflows/release.yml"
49
+ - ".github/workflows/test.yml"
62
50
  - ".gitignore"
63
51
  - ".rspec"
64
52
  - ".travis.yml"
65
53
  - Gemfile
66
- - Gemfile.lock
67
54
  - README.md
68
55
  - Rakefile
69
56
  - bin/console
@@ -75,7 +62,6 @@ files:
75
62
  homepage: https://github.com/d-mato/time_duration
76
63
  licenses: []
77
64
  metadata: {}
78
- post_install_message:
79
65
  rdoc_options: []
80
66
  require_paths:
81
67
  - lib
@@ -90,8 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
76
  - !ruby/object:Gem::Version
91
77
  version: '0'
92
78
  requirements: []
93
- rubygems_version: 3.0.3
94
- signing_key:
79
+ rubygems_version: 4.0.6
95
80
  specification_version: 4
96
81
  summary: This module provides functions for expressing durations
97
82
  test_files: []
data/Gemfile.lock DELETED
@@ -1,35 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- time-duration (0.1.3)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- diff-lcs (1.3)
10
- rake (10.5.0)
11
- rspec (3.8.0)
12
- rspec-core (~> 3.8.0)
13
- rspec-expectations (~> 3.8.0)
14
- rspec-mocks (~> 3.8.0)
15
- rspec-core (3.8.1)
16
- rspec-support (~> 3.8.0)
17
- rspec-expectations (3.8.4)
18
- diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.8.0)
20
- rspec-mocks (3.8.1)
21
- diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.8.0)
23
- rspec-support (3.8.2)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- bundler (~> 1.17)
30
- rake (~> 10.0)
31
- rspec (~> 3.0)
32
- time-duration!
33
-
34
- BUNDLED WITH
35
- 1.17.2