time 0.3.0 → 0.4.1
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 +38 -35
- metadata +8 -15
- data/.github/dependabot.yml +0 -6
- data/.github/workflows/test.yml +0 -28
- data/.gitignore +0 -8
- data/Gemfile +0 -8
- data/Rakefile +0 -10
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/time.gemspec +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c211ffd223b56fae14493d2d7fb187ac2e7fa4f089943fba05174f0ee9549c4c
|
4
|
+
data.tar.gz: df4434890036e502a795ac24cfb93920ace49539b4ef2f092942cdef049ba141
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 247084d1b3bbdda9a0f21652daf9d729a2f32d3aa89a16c3e4b78d305c49fa487c75386a80ebcd88b9bf0ccec224ae1aa1989baa4a96bbdb88e580b97812521f
|
7
|
+
data.tar.gz: 578f214835d4259e3a4cd9aff080806b29a04c886b90f8acd4f95527af581698722423fd85a4ef3e0d911b7f8f797adfdddfb3239c4cba20e4970299271b3a70
|
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
@@ -26,7 +26,7 @@ require 'date'
|
|
26
26
|
|
27
27
|
class Time
|
28
28
|
|
29
|
-
VERSION = "0.
|
29
|
+
VERSION = "0.4.1" # :nodoc:
|
30
30
|
|
31
31
|
class << Time
|
32
32
|
|
@@ -280,7 +280,7 @@ class Time
|
|
280
280
|
#
|
281
281
|
# This method **does not** function as a validator. If the input
|
282
282
|
# string does not match valid formats strictly, you may get a
|
283
|
-
# cryptic result. Should consider to use
|
283
|
+
# cryptic result. Should consider to use Time.strptime instead
|
284
284
|
# of this method as possible.
|
285
285
|
#
|
286
286
|
# require 'time'
|
@@ -391,6 +391,8 @@ class Time
|
|
391
391
|
# heuristic to detect the format of the input string, you provide
|
392
392
|
# a second argument that describes the format of the string.
|
393
393
|
#
|
394
|
+
# Raises ArgumentError if the date or format is invalid.
|
395
|
+
#
|
394
396
|
# If a block is given, the year described in +date+ is converted by the
|
395
397
|
# block. For example:
|
396
398
|
#
|
@@ -405,7 +407,7 @@ class Time
|
|
405
407
|
# %c :: The preferred local date and time representation
|
406
408
|
# %C :: Century (20 in 2009)
|
407
409
|
# %d :: Day of the month (01..31)
|
408
|
-
# %D :: Date (%m/%d/%y)
|
410
|
+
# %D :: \Date (%m/%d/%y)
|
409
411
|
# %e :: Day of the month, blank-padded ( 1..31)
|
410
412
|
# %F :: Equivalent to %Y-%m-%d (the ISO 8601 date format)
|
411
413
|
# %g :: The last two digits of the commercial year
|
@@ -442,8 +444,8 @@ class Time
|
|
442
444
|
# %X :: Preferred representation for the time alone, no date
|
443
445
|
# %y :: Year without a century (00..99)
|
444
446
|
# %Y :: Year which may include century, if provided
|
445
|
-
# %z :: Time zone as
|
446
|
-
# %Z :: Time zone name
|
447
|
+
# %z :: \Time zone as hour offset from UTC (e.g. +0900)
|
448
|
+
# %Z :: \Time zone name
|
447
449
|
# %% :: Literal "%" character
|
448
450
|
# %+ :: date(1) (%a %b %e %H:%M:%S %Z %Y)
|
449
451
|
#
|
@@ -455,7 +457,7 @@ class Time
|
|
455
457
|
#
|
456
458
|
def strptime(date, format, now=self.now)
|
457
459
|
d = Date._strptime(date, format)
|
458
|
-
raise ArgumentError, "invalid date or strptime format -
|
460
|
+
raise ArgumentError, "invalid date or strptime format - '#{date}' '#{format}'" unless d
|
459
461
|
if seconds = d[:seconds]
|
460
462
|
if sec_fraction = d[:sec_fraction]
|
461
463
|
usec = sec_fraction * 1000000
|
@@ -693,35 +695,36 @@ class Time
|
|
693
695
|
getutc.strftime('%a, %d %b %Y %T GMT')
|
694
696
|
end
|
695
697
|
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
#
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
fraction_digits
|
719
|
-
|
720
|
-
|
721
|
-
|
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"))
|
722
727
|
end
|
723
|
-
s << (utc? ? 'Z' : strftime("%:z"))
|
724
728
|
end
|
725
|
-
alias iso8601 xmlschema
|
729
|
+
alias iso8601 xmlschema unless method_defined?(:iso8601)
|
726
730
|
end
|
727
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanaka Akira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: date
|
@@ -31,17 +31,10 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
-
|
35
|
-
-
|
36
|
-
- ".gitignore"
|
37
|
-
- Gemfile
|
38
|
-
- LICENSE.txt
|
34
|
+
- BSDL
|
35
|
+
- COPYING
|
39
36
|
- README.md
|
40
|
-
- Rakefile
|
41
|
-
- bin/console
|
42
|
-
- bin/setup
|
43
37
|
- lib/time.rb
|
44
|
-
- time.gemspec
|
45
38
|
homepage: https://github.com/ruby/time
|
46
39
|
licenses:
|
47
40
|
- Ruby
|
@@ -49,7 +42,7 @@ licenses:
|
|
49
42
|
metadata:
|
50
43
|
homepage_uri: https://github.com/ruby/time
|
51
44
|
source_code_uri: https://github.com/ruby/time
|
52
|
-
post_install_message:
|
45
|
+
post_install_message:
|
53
46
|
rdoc_options: []
|
54
47
|
require_paths:
|
55
48
|
- lib
|
@@ -64,8 +57,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
57
|
- !ruby/object:Gem::Version
|
65
58
|
version: '0'
|
66
59
|
requirements: []
|
67
|
-
rubygems_version: 3.5.
|
68
|
-
signing_key:
|
60
|
+
rubygems_version: 3.5.11
|
61
|
+
signing_key:
|
69
62
|
specification_version: 4
|
70
63
|
summary: Extends the Time class with methods for parsing and conversion.
|
71
64
|
test_files: []
|
data/.github/dependabot.yml
DELETED
data/.github/workflows/test.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
name: ubuntu
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
ruby-versions:
|
7
|
-
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
8
|
-
with:
|
9
|
-
engine: cruby
|
10
|
-
min_version: 2.6
|
11
|
-
|
12
|
-
build:
|
13
|
-
needs: ruby-versions
|
14
|
-
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
15
|
-
strategy:
|
16
|
-
matrix:
|
17
|
-
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
18
|
-
os: [ ubuntu-latest, macos-latest ]
|
19
|
-
runs-on: ${{ matrix.os }}
|
20
|
-
steps:
|
21
|
-
- uses: actions/checkout@v4
|
22
|
-
- name: Set up Ruby
|
23
|
-
uses: ruby/setup-ruby@v1
|
24
|
-
with:
|
25
|
-
ruby-version: ${{ matrix.ruby }}
|
26
|
-
bundler-cache: true
|
27
|
-
- name: Run test
|
28
|
-
run: bundle exec rake test
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
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,31 +0,0 @@
|
|
1
|
-
name = File.basename(__FILE__, ".gemspec")
|
2
|
-
version = ["lib", Array.new(name.count("-")+1).join("/")].find do |dir|
|
3
|
-
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
|
4
|
-
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
|
5
|
-
end rescue nil
|
6
|
-
end
|
7
|
-
|
8
|
-
Gem::Specification.new do |spec|
|
9
|
-
spec.name = name
|
10
|
-
spec.version = version
|
11
|
-
spec.authors = ["Tanaka Akira"]
|
12
|
-
spec.email = ["akr@fsij.org"]
|
13
|
-
|
14
|
-
spec.summary = %q{Extends the Time class with methods for parsing and conversion.}
|
15
|
-
spec.description = %q{Extends the Time class with methods for parsing and conversion.}
|
16
|
-
spec.homepage = "https://github.com/ruby/time"
|
17
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
18
|
-
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
19
|
-
|
20
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
22
|
-
|
23
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
-
end
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
|
30
|
-
spec.add_dependency "date"
|
31
|
-
end
|