time 0.2.2 → 0.4.0
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 +4 -4
- data/{LICENSE.txt → BSDL} +3 -3
- data/COPYING +56 -0
- data/lib/time.rb +36 -30
- metadata +6 -16
- data/.github/dependabot.yml +0 -6
- data/.github/workflows/test.yml +0 -20
- data/.gitignore +0 -8
- data/Gemfile +0 -7
- data/Rakefile +0 -17
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/time.gemspec +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01ec7646c0aa3fd277a865dee712c2f5e97343803376d57660a4d7b494b1e35f
|
4
|
+
data.tar.gz: 3b2b35d2938f05a4e8b6b484296c632b0963eb7fccc581b2198f4a467d9db536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eee9ccbee2fa24d6a4d43d80d95696a4bbde54c89eb21f958e5c3035126b4d4fb5941834953c68cc6ca025ddcf8711cbbde5a2c97ee263cce9a4ad482ba5fb4a
|
7
|
+
data.tar.gz: 8fe4756d54b2ec60ef47d1ee4f85e1815ac0d5e49c8a820f3501e173d6b302e094ab89008f0f76cd40f84642b1d1a23ade4e9f356fca66078397979802712254
|
data/{LICENSE.txt → BSDL}
RENAMED
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
|
|
4
4
|
modification, are permitted provided that the following conditions
|
5
5
|
are met:
|
6
6
|
1. Redistributions of source code must retain the above copyright
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
8
|
2. Redistributions in binary form must reproduce the above copyright
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
10
|
-
documentation and/or other materials provided with the distribution.
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
11
|
|
12
12
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
13
13
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
data/COPYING
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
4
|
+
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
6
|
+
software without restriction, provided that you duplicate all of the
|
7
|
+
original copyright notices and associated disclaimers.
|
8
|
+
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
10
|
+
you do at least ONE of the following:
|
11
|
+
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
13
|
+
make them Freely Available, such as by posting said
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
|
+
|
17
|
+
b. use the modified software only within your corporation or
|
18
|
+
organization.
|
19
|
+
|
20
|
+
c. give non-standard binaries non-standard names, with
|
21
|
+
instructions on where to get the original software distribution.
|
22
|
+
|
23
|
+
d. make other distribution arrangements with the author.
|
24
|
+
|
25
|
+
3. You may distribute the software in object code or binary form,
|
26
|
+
provided that you do at least ONE of the following:
|
27
|
+
|
28
|
+
a. distribute the binaries and library files of the software,
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
|
+
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
33
|
+
the software.
|
34
|
+
|
35
|
+
c. give non-standard binaries non-standard names, with
|
36
|
+
instructions on where to get the original software distribution.
|
37
|
+
|
38
|
+
d. make other distribution arrangements with the author.
|
39
|
+
|
40
|
+
4. You may modify and include the part of the software into any other
|
41
|
+
software (possibly commercial). But some files in the distribution
|
42
|
+
are not written by the author, so that they are not under these terms.
|
43
|
+
|
44
|
+
For the list of those files and their copying conditions, see the
|
45
|
+
file LEGAL.
|
46
|
+
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
48
|
+
output from the software do not automatically fall under the
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
51
|
+
software.
|
52
|
+
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
56
|
+
PURPOSE.
|
data/lib/time.rb
CHANGED
@@ -25,6 +25,9 @@ require 'date'
|
|
25
25
|
# :startdoc:
|
26
26
|
|
27
27
|
class Time
|
28
|
+
|
29
|
+
VERSION = "0.4.0"
|
30
|
+
|
28
31
|
class << Time
|
29
32
|
|
30
33
|
#
|
@@ -388,6 +391,8 @@ class Time
|
|
388
391
|
# heuristic to detect the format of the input string, you provide
|
389
392
|
# a second argument that describes the format of the string.
|
390
393
|
#
|
394
|
+
# Raises `ArgumentError` if the date or format is invalid.
|
395
|
+
#
|
391
396
|
# If a block is given, the year described in +date+ is converted by the
|
392
397
|
# block. For example:
|
393
398
|
#
|
@@ -452,7 +457,7 @@ class Time
|
|
452
457
|
#
|
453
458
|
def strptime(date, format, now=self.now)
|
454
459
|
d = Date._strptime(date, format)
|
455
|
-
raise ArgumentError, "invalid date or strptime format -
|
460
|
+
raise ArgumentError, "invalid date or strptime format - '#{date}' '#{format}'" unless d
|
456
461
|
if seconds = d[:seconds]
|
457
462
|
if sec_fraction = d[:sec_fraction]
|
458
463
|
usec = sec_fraction * 1000000
|
@@ -690,35 +695,36 @@ class Time
|
|
690
695
|
getutc.strftime('%a, %d %b %Y %T GMT')
|
691
696
|
end
|
692
697
|
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
#
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
fraction_digits
|
716
|
-
|
717
|
-
|
718
|
-
|
698
|
+
unless method_defined?(:xmlschema)
|
699
|
+
#
|
700
|
+
# Returns a string which represents the time as a dateTime defined by XML
|
701
|
+
# Schema:
|
702
|
+
#
|
703
|
+
# CCYY-MM-DDThh:mm:ssTZD
|
704
|
+
# CCYY-MM-DDThh:mm:ss.sssTZD
|
705
|
+
#
|
706
|
+
# where TZD is Z or [+-]hh:mm.
|
707
|
+
#
|
708
|
+
# If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
|
709
|
+
#
|
710
|
+
# +fraction_digits+ specifies a number of digits to use for fractional
|
711
|
+
# seconds. Its default value is 0.
|
712
|
+
#
|
713
|
+
# require 'time'
|
714
|
+
#
|
715
|
+
# t = Time.now
|
716
|
+
# t.iso8601 # => "2011-10-05T22:26:12-04:00"
|
717
|
+
#
|
718
|
+
# You must require 'time' to use this method.
|
719
|
+
#
|
720
|
+
def xmlschema(fraction_digits=0)
|
721
|
+
fraction_digits = fraction_digits.to_i
|
722
|
+
s = strftime("%FT%T")
|
723
|
+
if fraction_digits > 0
|
724
|
+
s << strftime(".%#{fraction_digits}N")
|
725
|
+
end
|
726
|
+
s << (utc? ? 'Z' : strftime("%:z"))
|
719
727
|
end
|
720
|
-
s << (utc? ? 'Z' : strftime("%:z"))
|
721
728
|
end
|
722
|
-
alias iso8601 xmlschema
|
729
|
+
alias iso8601 xmlschema unless method_defined?(:iso8601)
|
723
730
|
end
|
724
|
-
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanaka Akira
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2024-09-06 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: date
|
@@ -31,17 +30,10 @@ executables: []
|
|
31
30
|
extensions: []
|
32
31
|
extra_rdoc_files: []
|
33
32
|
files:
|
34
|
-
-
|
35
|
-
-
|
36
|
-
- ".gitignore"
|
37
|
-
- Gemfile
|
38
|
-
- LICENSE.txt
|
33
|
+
- BSDL
|
34
|
+
- COPYING
|
39
35
|
- README.md
|
40
|
-
- Rakefile
|
41
|
-
- bin/console
|
42
|
-
- bin/setup
|
43
36
|
- lib/time.rb
|
44
|
-
- time.gemspec
|
45
37
|
homepage: https://github.com/ruby/time
|
46
38
|
licenses:
|
47
39
|
- Ruby
|
@@ -49,7 +41,6 @@ licenses:
|
|
49
41
|
metadata:
|
50
42
|
homepage_uri: https://github.com/ruby/time
|
51
43
|
source_code_uri: https://github.com/ruby/time
|
52
|
-
post_install_message:
|
53
44
|
rdoc_options: []
|
54
45
|
require_paths:
|
55
46
|
- lib
|
@@ -57,15 +48,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
48
|
requirements:
|
58
49
|
- - ">="
|
59
50
|
- !ruby/object:Gem::Version
|
60
|
-
version: 2.
|
51
|
+
version: 2.4.0
|
61
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
53
|
requirements:
|
63
54
|
- - ">="
|
64
55
|
- !ruby/object:Gem::Version
|
65
56
|
version: '0'
|
66
57
|
requirements: []
|
67
|
-
rubygems_version: 3.
|
68
|
-
signing_key:
|
58
|
+
rubygems_version: 3.6.0.dev
|
69
59
|
specification_version: 4
|
70
60
|
summary: Extends the Time class with methods for parsing and conversion.
|
71
61
|
test_files: []
|
data/.github/dependabot.yml
DELETED
data/.github/workflows/test.yml
DELETED
@@ -1,20 +0,0 @@
|
|
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/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs << "test/lib"
|
6
|
-
t.ruby_opts << "-rhelper"
|
7
|
-
t.test_files = FileList["test/**/test_*.rb"]
|
8
|
-
end
|
9
|
-
|
10
|
-
task :sync_tool do
|
11
|
-
require 'fileutils'
|
12
|
-
FileUtils.cp "../ruby/tool/lib/core_assertions.rb", "./test/lib"
|
13
|
-
FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
|
14
|
-
FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
|
15
|
-
end
|
16
|
-
|
17
|
-
task :default => :test
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "time"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/time.gemspec
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |spec|
|
2
|
-
spec.name = "time"
|
3
|
-
spec.version = "0.2.2"
|
4
|
-
spec.authors = ["Tanaka Akira"]
|
5
|
-
spec.email = ["akr@fsij.org"]
|
6
|
-
|
7
|
-
spec.summary = %q{Extends the Time class with methods for parsing and conversion.}
|
8
|
-
spec.description = %q{Extends the Time class with methods for parsing and conversion.}
|
9
|
-
spec.homepage = "https://github.com/ruby/time"
|
10
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
11
|
-
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
12
|
-
|
13
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
14
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
15
|
-
|
16
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
17
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
end
|
19
|
-
spec.bindir = "exe"
|
20
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = ["lib"]
|
22
|
-
|
23
|
-
spec.add_dependency "date"
|
24
|
-
end
|