time 0.4.1 → 0.4.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 +4 -4
- data/.document +4 -0
- data/.rdoc_options +2 -0
- data/README.md +7 -5
- data/lib/time.rb +10 -6
- metadata +5 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc9964ca1d565e8395c46c83ffcf74b0a69ba3655dae9869a1a90f349b8d6586
|
|
4
|
+
data.tar.gz: c7500638e2132c8d5ed66243bea7d3e93f52933ecd504e159385a788e4682bc2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28c4cdaa51d8060a1ba0282fbe6d49e5f1b7574e693631fe2fd038503bc26a1e95004e8e931a908bdd3b8af11e7018307541e40163d62898422319d07ff40c02
|
|
7
|
+
data.tar.gz: 68b674ba7b85e2f7a2bb731bf89f515b81fcda6a5dd3501e8f1debb9bda574a530c6941fce013179ea54d91e8ddbf53ab1e7c1312226098bc17a10cb9a57bee5
|
data/.document
ADDED
data/.rdoc_options
ADDED
data/README.md
CHANGED
|
@@ -8,13 +8,16 @@ and converting Times.
|
|
|
8
8
|
This library extends the Time class with the following conversions between
|
|
9
9
|
date strings and Time objects:
|
|
10
10
|
|
|
11
|
-
* date-time defined by
|
|
12
|
-
* HTTP-date defined by
|
|
13
|
-
* dateTime defined by XML Schema Part 2: Datatypes (
|
|
14
|
-
8601}[http://www.iso.org/iso/date_and_time_format])
|
|
11
|
+
* date-time defined by [RFC 2822]
|
|
12
|
+
* HTTP-date defined by [RFC 2616]
|
|
13
|
+
* dateTime defined by XML Schema Part 2: Datatypes ([ISO 8601])
|
|
15
14
|
* various formats handled by Date._parse
|
|
16
15
|
* custom formats handled by Date._strptime
|
|
17
16
|
|
|
17
|
+
[RFC 2822]: http://www.ietf.org/rfc/rfc2822.txt
|
|
18
|
+
[RFC 2616]: http://www.ietf.org/rfc/rfc2616.txt
|
|
19
|
+
[ISO 8601]: http://www.iso.org/iso/date_and_time_format
|
|
20
|
+
|
|
18
21
|
## Installation
|
|
19
22
|
|
|
20
23
|
Add this line to your application's Gemfile:
|
|
@@ -51,4 +54,3 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
51
54
|
## Contributing
|
|
52
55
|
|
|
53
56
|
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/time.
|
|
54
|
-
|
data/lib/time.rb
CHANGED
|
@@ -24,9 +24,10 @@ require 'date'
|
|
|
24
24
|
|
|
25
25
|
# :startdoc:
|
|
26
26
|
|
|
27
|
+
# #
|
|
27
28
|
class Time
|
|
28
29
|
|
|
29
|
-
VERSION = "0.4.
|
|
30
|
+
VERSION = "0.4.2" # :nodoc:
|
|
30
31
|
|
|
31
32
|
class << Time
|
|
32
33
|
|
|
@@ -79,7 +80,7 @@ class Time
|
|
|
79
80
|
#
|
|
80
81
|
# You must require 'time' to use this method.
|
|
81
82
|
#
|
|
82
|
-
def zone_offset(zone, year=
|
|
83
|
+
def zone_offset(zone, year=nil)
|
|
83
84
|
off = nil
|
|
84
85
|
zone = zone.upcase
|
|
85
86
|
if /\A([+-])(\d\d)(:?)(\d\d)(?:\3(\d\d))?\z/ =~ zone
|
|
@@ -88,10 +89,13 @@ class Time
|
|
|
88
89
|
off = zone.to_i * 3600
|
|
89
90
|
elsif ZoneOffset.include?(zone)
|
|
90
91
|
off = ZoneOffset[zone] * 3600
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
else
|
|
93
|
+
year ||= self.now.year
|
|
94
|
+
if ((t = self.local(year, 1, 1)).zone.upcase == zone rescue false)
|
|
95
|
+
off = t.utc_offset
|
|
96
|
+
elsif ((t = self.local(year, 7, 1)).zone.upcase == zone rescue false)
|
|
97
|
+
off = t.utc_offset
|
|
98
|
+
end
|
|
95
99
|
end
|
|
96
100
|
off
|
|
97
101
|
end
|
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.
|
|
4
|
+
version: 0.4.2
|
|
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: 2025-12-17 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: date
|
|
@@ -31,6 +30,8 @@ executables: []
|
|
|
31
30
|
extensions: []
|
|
32
31
|
extra_rdoc_files: []
|
|
33
32
|
files:
|
|
33
|
+
- ".document"
|
|
34
|
+
- ".rdoc_options"
|
|
34
35
|
- BSDL
|
|
35
36
|
- COPYING
|
|
36
37
|
- README.md
|
|
@@ -42,7 +43,6 @@ licenses:
|
|
|
42
43
|
metadata:
|
|
43
44
|
homepage_uri: https://github.com/ruby/time
|
|
44
45
|
source_code_uri: https://github.com/ruby/time
|
|
45
|
-
post_install_message:
|
|
46
46
|
rdoc_options: []
|
|
47
47
|
require_paths:
|
|
48
48
|
- lib
|
|
@@ -57,8 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
58
|
version: '0'
|
|
59
59
|
requirements: []
|
|
60
|
-
rubygems_version: 3.
|
|
61
|
-
signing_key:
|
|
60
|
+
rubygems_version: 3.6.9
|
|
62
61
|
specification_version: 4
|
|
63
62
|
summary: Extends the Time class with methods for parsing and conversion.
|
|
64
63
|
test_files: []
|