time 0.1.1 → 0.2.2

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
  SHA256:
3
- metadata.gz: 15e8574e213d15cfd7b411f51b77558c8c0b5cddb94e02f1d8e1ac348dd94bb8
4
- data.tar.gz: 31fea0688adc521bd18b56dcdcac15d450781d523c04c7979003fce9fd6ee19d
3
+ metadata.gz: c649f3e03bc94c67fb970de271850e36dc34f9734b8346b507a36c55e9f7997b
4
+ data.tar.gz: b6363dc0af8599975a0e58edbbf7a39ce9b59f1cfe9072806a3179d0cbf455b6
5
5
  SHA512:
6
- metadata.gz: 3ddaed6b6b3f00d9e5f67894232cc93b708ca51e45d30e8dac48efbd716f23cf89080db1a38355f8c54b51d121b140ea196be424ef36d722664e30a248b59efc
7
- data.tar.gz: 0f2117e35e6343d59e72ed6a0041ccdad8594ffd2e0420ee35c763ed3cf4c799913b376d30eab5365b9487e045b24867cfa15e0b3655de86c83e937c704e4cdc
6
+ metadata.gz: 6aa3f46a4ac364d93d54f3d3992f514d9893894603808158afecc12cc864e9b3739a96205b48c928c309d7aa330f0a6202be520f3ca9360e025f289b7902bae8
7
+ data.tar.gz: 5adb6fc047ab5b42c9931c58398db41c0b613444a705f07885a6330c7a4a267e48ae9b0916649a83f110da1c7889989ce6662993d2de50803837a831b1872c58
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'weekly'
@@ -0,0 +1,20 @@
1
+ name: ubuntu
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
+ strategy:
9
+ matrix:
10
+ ruby: [ '3.0', 2.7, 2.6, head ]
11
+ os: [ ubuntu-latest, macos-latest ]
12
+ runs-on: ${{ matrix.os }}
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ - name: Run test
20
+ run: rake test
data/Gemfile CHANGED
@@ -4,4 +4,4 @@ source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  gem "rake", "~> 12.0"
7
- gem "minitest", "~> 5.0"
7
+ gem "test-unit"
data/lib/time.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # shareable_constant_value: literal
2
3
 
3
4
  require 'date'
4
5
 
@@ -92,6 +93,7 @@ class Time
92
93
  off
93
94
  end
94
95
 
96
+ # :stopdoc:
95
97
  def zone_utc?(zone)
96
98
  # * +0000
97
99
  # In RFC 2822, +0000 indicate a time zone at Universal Time.
@@ -267,6 +269,7 @@ class Time
267
269
  end
268
270
  end
269
271
  private :make_time
272
+ # :startdoc:
270
273
 
271
274
  #
272
275
  # Takes a string representation of a Time and attempts to parse it
@@ -664,30 +667,10 @@ class Time
664
667
  # You must require 'time' to use this method.
665
668
  #
666
669
  def rfc2822
667
- sprintf('%s, %02d %s %0*d %02d:%02d:%02d ',
668
- RFC2822_DAY_NAME[wday],
669
- day, RFC2822_MONTH_NAME[mon-1], year < 0 ? 5 : 4, year,
670
- hour, min, sec) <<
671
- if utc?
672
- '-0000'
673
- else
674
- off = utc_offset
675
- sign = off < 0 ? '-' : '+'
676
- sprintf('%s%02d%02d', sign, *(off.abs / 60).divmod(60))
677
- end
670
+ strftime('%a, %d %b %Y %T ') << (utc? ? '-0000' : strftime('%z'))
678
671
  end
679
672
  alias rfc822 rfc2822
680
673
 
681
-
682
- RFC2822_DAY_NAME = [ # :nodoc:
683
- 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
684
- ]
685
-
686
- RFC2822_MONTH_NAME = [ # :nodoc:
687
- 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
688
- 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
689
- ]
690
-
691
674
  #
692
675
  # Returns a string which represents the time as RFC 1123 date of HTTP-date
693
676
  # defined by RFC 2616:
@@ -704,11 +687,7 @@ class Time
704
687
  # You must require 'time' to use this method.
705
688
  #
706
689
  def httpdate
707
- t = dup.utc
708
- sprintf('%s, %02d %s %0*d %02d:%02d:%02d GMT',
709
- RFC2822_DAY_NAME[t.wday],
710
- t.day, RFC2822_MONTH_NAME[t.mon-1], t.year < 0 ? 5 : 4, t.year,
711
- t.hour, t.min, t.sec)
690
+ getutc.strftime('%a, %d %b %Y %T GMT')
712
691
  end
713
692
 
714
693
  #
@@ -722,7 +701,7 @@ class Time
722
701
  #
723
702
  # If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
724
703
  #
725
- # +fractional_digits+ specifies a number of digits to use for fractional
704
+ # +fraction_digits+ specifies a number of digits to use for fractional
726
705
  # seconds. Its default value is 0.
727
706
  #
728
707
  # require 'time'
data/time.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "time"
3
- spec.version = "0.1.1"
3
+ spec.version = "0.2.2"
4
4
  spec.authors = ["Tanaka Akira"]
5
5
  spec.email = ["akr@fsij.org"]
6
6
 
@@ -19,4 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.bindir = "exe"
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "date"
22
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanaka Akira
@@ -9,7 +9,21 @@ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
11
  date: 2023-03-30 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: date
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: Extends the Time class with methods for parsing and conversion.
14
28
  email:
15
29
  - akr@fsij.org
@@ -17,6 +31,8 @@ executables: []
17
31
  extensions: []
18
32
  extra_rdoc_files: []
19
33
  files:
34
+ - ".github/dependabot.yml"
35
+ - ".github/workflows/test.yml"
20
36
  - ".gitignore"
21
37
  - Gemfile
22
38
  - LICENSE.txt