steep 0.13.0 → 0.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +0 -3
- data/CHANGELOG.md +28 -0
- data/Rakefile +0 -13
- data/bin/setup +0 -2
- data/bin/smoke_runner.rb +0 -1
- data/exe/steep +0 -1
- data/lib/steep.rb +33 -1
- data/lib/steep/annotation_parser.rb +4 -4
- data/lib/steep/ast/buffer.rb +11 -7
- data/lib/steep/ast/builtin.rb +8 -0
- data/lib/steep/ast/types/factory.rb +124 -89
- data/lib/steep/cli.rb +16 -1
- data/lib/steep/drivers/annotations.rb +1 -1
- data/lib/steep/drivers/check.rb +20 -4
- data/lib/steep/drivers/init.rb +5 -5
- data/lib/steep/drivers/langserver.rb +13 -287
- data/lib/steep/drivers/utils/driver_helper.rb +1 -1
- data/lib/steep/drivers/vendor.rb +2 -2
- data/lib/steep/drivers/watch.rb +97 -85
- data/lib/steep/drivers/worker.rb +51 -0
- data/lib/steep/project.rb +9 -5
- data/lib/steep/project/completion_provider.rb +298 -0
- data/lib/steep/project/dsl.rb +14 -0
- data/lib/steep/project/file.rb +54 -47
- data/lib/steep/project/hover_content.rb +17 -8
- data/lib/steep/project/options.rb +25 -3
- data/lib/steep/project/target.rb +40 -24
- data/lib/steep/server/base_worker.rb +56 -0
- data/lib/steep/server/code_worker.rb +151 -0
- data/lib/steep/server/interaction_worker.rb +281 -0
- data/lib/steep/server/master.rb +196 -0
- data/lib/steep/server/signature_worker.rb +148 -0
- data/lib/steep/server/utils.rb +36 -0
- data/lib/steep/server/worker_process.rb +62 -0
- data/lib/steep/signature/errors.rb +1 -1
- data/lib/steep/signature/validator.rb +13 -13
- data/lib/steep/source.rb +1 -1
- data/lib/steep/type_construction.rb +1004 -727
- data/lib/steep/type_inference/constant_env.rb +3 -11
- data/lib/steep/type_inference/context.rb +8 -3
- data/lib/steep/type_inference/context_array.rb +111 -0
- data/lib/steep/type_inference/local_variable_type_env.rb +226 -0
- data/lib/steep/type_inference/logic.rb +130 -0
- data/lib/steep/type_inference/type_env.rb +5 -69
- data/lib/steep/typing.rb +91 -23
- data/lib/steep/version.rb +1 -1
- data/smoke/alias/Steepfile +1 -0
- data/smoke/alias/a.rb +1 -1
- data/smoke/and/Steepfile +1 -0
- data/smoke/array/Steepfile +1 -0
- data/smoke/array/b.rb +0 -2
- data/smoke/block/Steepfile +1 -0
- data/smoke/case/Steepfile +1 -0
- data/smoke/class/Steepfile +1 -0
- data/smoke/const/Steepfile +1 -0
- data/smoke/dstr/Steepfile +1 -0
- data/smoke/ensure/Steepfile +1 -0
- data/smoke/enumerator/Steepfile +1 -0
- data/smoke/extension/Steepfile +1 -0
- data/smoke/extension/c.rb +1 -0
- data/smoke/hash/Steepfile +1 -0
- data/smoke/hello/Steepfile +1 -0
- data/smoke/if/Steepfile +1 -0
- data/smoke/if/a.rb +1 -1
- data/smoke/implements/Steepfile +1 -0
- data/smoke/initialize/Steepfile +1 -0
- data/smoke/integer/Steepfile +1 -0
- data/smoke/interface/Steepfile +1 -0
- data/smoke/kwbegin/Steepfile +1 -0
- data/smoke/lambda/Steepfile +1 -0
- data/smoke/literal/Steepfile +1 -0
- data/smoke/map/Steepfile +1 -0
- data/smoke/method/Steepfile +1 -0
- data/smoke/module/Steepfile +1 -0
- data/smoke/regexp/Steepfile +1 -0
- data/smoke/regexp/b.rb +4 -4
- data/smoke/regression/Steepfile +1 -0
- data/smoke/rescue/Steepfile +1 -0
- data/smoke/rescue/a.rb +1 -1
- data/smoke/self/Steepfile +1 -0
- data/smoke/skip/Steepfile +1 -0
- data/smoke/stdout/Steepfile +1 -0
- data/smoke/super/Steepfile +1 -0
- data/smoke/type_case/Steepfile +1 -0
- data/smoke/yield/Steepfile +1 -0
- data/steep.gemspec +8 -8
- metadata +38 -138
- data/exe/rbs +0 -3
- data/exe/ruby-signature +0 -3
- data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
- data/vendor/ruby-signature/.gitignore +0 -12
- data/vendor/ruby-signature/.rubocop.yml +0 -15
- data/vendor/ruby-signature/BSDL +0 -22
- data/vendor/ruby-signature/COPYING +0 -56
- data/vendor/ruby-signature/Gemfile +0 -6
- data/vendor/ruby-signature/README.md +0 -93
- data/vendor/ruby-signature/Rakefile +0 -66
- data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -156
- data/vendor/ruby-signature/bin/console +0 -14
- data/vendor/ruby-signature/bin/query-rdoc +0 -103
- data/vendor/ruby-signature/bin/setup +0 -10
- data/vendor/ruby-signature/bin/sort +0 -88
- data/vendor/ruby-signature/bin/test_runner.rb +0 -17
- data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
- data/vendor/ruby-signature/docs/sigs.md +0 -148
- data/vendor/ruby-signature/docs/stdlib.md +0 -152
- data/vendor/ruby-signature/docs/syntax.md +0 -528
- data/vendor/ruby-signature/exe/rbs +0 -3
- data/vendor/ruby-signature/exe/ruby-signature +0 -7
- data/vendor/ruby-signature/lib/ruby/signature.rb +0 -64
- data/vendor/ruby-signature/lib/ruby/signature/ast/annotation.rb +0 -29
- data/vendor/ruby-signature/lib/ruby/signature/ast/comment.rb +0 -29
- data/vendor/ruby-signature/lib/ruby/signature/ast/declarations.rb +0 -391
- data/vendor/ruby-signature/lib/ruby/signature/ast/members.rb +0 -364
- data/vendor/ruby-signature/lib/ruby/signature/buffer.rb +0 -52
- data/vendor/ruby-signature/lib/ruby/signature/builtin_names.rb +0 -54
- data/vendor/ruby-signature/lib/ruby/signature/cli.rb +0 -534
- data/vendor/ruby-signature/lib/ruby/signature/constant.rb +0 -28
- data/vendor/ruby-signature/lib/ruby/signature/constant_table.rb +0 -152
- data/vendor/ruby-signature/lib/ruby/signature/definition.rb +0 -172
- data/vendor/ruby-signature/lib/ruby/signature/definition_builder.rb +0 -921
- data/vendor/ruby-signature/lib/ruby/signature/environment.rb +0 -283
- data/vendor/ruby-signature/lib/ruby/signature/environment_loader.rb +0 -138
- data/vendor/ruby-signature/lib/ruby/signature/environment_walker.rb +0 -126
- data/vendor/ruby-signature/lib/ruby/signature/errors.rb +0 -189
- data/vendor/ruby-signature/lib/ruby/signature/location.rb +0 -104
- data/vendor/ruby-signature/lib/ruby/signature/method_type.rb +0 -125
- data/vendor/ruby-signature/lib/ruby/signature/namespace.rb +0 -93
- data/vendor/ruby-signature/lib/ruby/signature/parser.y +0 -1343
- data/vendor/ruby-signature/lib/ruby/signature/prototype/rb.rb +0 -441
- data/vendor/ruby-signature/lib/ruby/signature/prototype/rbi.rb +0 -579
- data/vendor/ruby-signature/lib/ruby/signature/prototype/runtime.rb +0 -383
- data/vendor/ruby-signature/lib/ruby/signature/substitution.rb +0 -48
- data/vendor/ruby-signature/lib/ruby/signature/test.rb +0 -28
- data/vendor/ruby-signature/lib/ruby/signature/test/errors.rb +0 -63
- data/vendor/ruby-signature/lib/ruby/signature/test/hook.rb +0 -290
- data/vendor/ruby-signature/lib/ruby/signature/test/setup.rb +0 -58
- data/vendor/ruby-signature/lib/ruby/signature/test/spy.rb +0 -324
- data/vendor/ruby-signature/lib/ruby/signature/test/test_helper.rb +0 -185
- data/vendor/ruby-signature/lib/ruby/signature/test/type_check.rb +0 -256
- data/vendor/ruby-signature/lib/ruby/signature/type_name.rb +0 -72
- data/vendor/ruby-signature/lib/ruby/signature/types.rb +0 -932
- data/vendor/ruby-signature/lib/ruby/signature/variance_calculator.rb +0 -140
- data/vendor/ruby-signature/lib/ruby/signature/vendorer.rb +0 -49
- data/vendor/ruby-signature/lib/ruby/signature/version.rb +0 -5
- data/vendor/ruby-signature/lib/ruby/signature/writer.rb +0 -271
- data/vendor/ruby-signature/ruby-signature.gemspec +0 -45
- data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -3
- data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -15
- data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
- data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
- data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
- data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -35
- data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
- data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
- data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
- data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
- data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
- data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
- data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -419
- data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -606
- data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
- data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
- data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
- data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
- data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -193
- data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
- data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
- data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -476
- data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
- data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
- data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -121
- data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
- data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -710
- data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
- data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -574
- data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -135
- data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -141
- data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -66
- data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -182
- data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -248
- data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
- data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
- data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
- data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -426
- data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -354
- data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -93
- data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
- data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
- data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -10
- data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -131
- data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
- data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
- data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -770
- data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -13
- data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -230
- data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1112
- data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
- data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -739
- data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -91
- data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
- data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -159
- data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
- data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -18
- data/vendor/ruby-signature/stdlib/find/find.rbs +0 -44
- data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -21
- data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
- data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
- data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
- data/vendor/ruby-signature/stdlib/set/set.rbs +0 -77
- data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,23 +0,0 @@
|
|
1
|
-
# [ThreadGroup](ThreadGroup) provides a means of
|
2
|
-
# keeping track of a number of threads as a group.
|
3
|
-
#
|
4
|
-
# A given [Thread](https://ruby-doc.org/core-2.6.3/Thread.html) object can
|
5
|
-
# only belong to one [ThreadGroup](ThreadGroup) at a
|
6
|
-
# time; adding a thread to a new group will remove it from any previous
|
7
|
-
# group.
|
8
|
-
#
|
9
|
-
# Newly created threads belong to the same group as the thread from which
|
10
|
-
# they were created.
|
11
|
-
class ThreadGroup < Object
|
12
|
-
def add: (Thread thread) -> ThreadGroup
|
13
|
-
|
14
|
-
def enclose: () -> ThreadGroup
|
15
|
-
|
16
|
-
# Returns `true` if the `thgrp` is enclosed. See also
|
17
|
-
# [\#enclose](ThreadGroup.downloaded.ruby_doc#method-i-enclose).
|
18
|
-
def enclosed?: () -> bool
|
19
|
-
|
20
|
-
def list: () -> ::Array[Thread]
|
21
|
-
end
|
22
|
-
|
23
|
-
ThreadGroup::Default: ThreadGroup
|
@@ -1,739 +0,0 @@
|
|
1
|
-
# [Time](Time) is an abstraction of dates and times.
|
2
|
-
# [Time](Time) is stored internally as the number of
|
3
|
-
# seconds with fraction since the *Epoch* , January 1, 1970 00:00 UTC.
|
4
|
-
# Also see the library module Date. The [Time](Time)
|
5
|
-
# class treats GMT (Greenwich Mean [Time](Time) ) and
|
6
|
-
# UTC (Coordinated Universal [Time](Time) ) as
|
7
|
-
# equivalent. GMT is the older way of referring to these baseline times
|
8
|
-
# but persists in the names of calls on POSIX systems.
|
9
|
-
#
|
10
|
-
# All times may have fraction. Be aware of this fact when comparing times
|
11
|
-
# with each other – times that are apparently equal when displayed may be
|
12
|
-
# different when compared.
|
13
|
-
#
|
14
|
-
# Since Ruby 1.9.2, [Time](Time) implementation uses a
|
15
|
-
# signed 63 bit integer, Bignum or
|
16
|
-
# [Rational](https://ruby-doc.org/core-2.6.3/Rational.html). The integer
|
17
|
-
# is a number of nanoseconds since the *Epoch* which can represent
|
18
|
-
# 1823-11-12 to 2116-02-20. When Bignum or
|
19
|
-
# [Rational](https://ruby-doc.org/core-2.6.3/Rational.html) is used
|
20
|
-
# (before 1823, after 2116, under nanosecond),
|
21
|
-
# [Time](Time) works slower as when integer is used.
|
22
|
-
#
|
23
|
-
#
|
24
|
-
# All of these examples were done using the EST timezone which is GMT-5.
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# You can create a new instance of [Time](Time) with
|
28
|
-
# [::new](Time#method-c-new). This will use the
|
29
|
-
# current system time. [::now](Time#method-c-now) is
|
30
|
-
# an alias for this. You can also pass parts of the time to
|
31
|
-
# [::new](Time#method-c-new) such as year, month,
|
32
|
-
# minute, etc. When you want to construct a time this way you must pass at
|
33
|
-
# least a year. If you pass the year with nothing else time will default
|
34
|
-
# to January 1 of that year at 00:00:00 with the current system timezone.
|
35
|
-
# Here are some examples:
|
36
|
-
#
|
37
|
-
# ```ruby
|
38
|
-
# Time.new(2002) #=> 2002-01-01 00:00:00 -0500
|
39
|
-
# Time.new(2002, 10) #=> 2002-10-01 00:00:00 -0500
|
40
|
-
# Time.new(2002, 10, 31) #=> 2002-10-31 00:00:00 -0500
|
41
|
-
# ```
|
42
|
-
#
|
43
|
-
# You can pass a UTC offset:
|
44
|
-
#
|
45
|
-
# ```ruby
|
46
|
-
# Time.new(2002, 10, 31, 2, 2, 2, "+02:00") #=> 2002-10-31 02:02:02 +0200
|
47
|
-
# ```
|
48
|
-
#
|
49
|
-
# Or a timezone object:
|
50
|
-
#
|
51
|
-
# ```ruby
|
52
|
-
# tz = timezone("Europe/Athens") # Eastern European Time, UTC+2
|
53
|
-
# Time.new(2002, 10, 31, 2, 2, 2, tz) #=> 2002-10-31 02:02:02 +0200
|
54
|
-
# ```
|
55
|
-
#
|
56
|
-
# You can also use [::gm](Time#method-c-gm),
|
57
|
-
# [::local](Time#method-c-local) and
|
58
|
-
# [::utc](Time#method-c-utc) to infer GMT, local and
|
59
|
-
# UTC timezones instead of using the current system setting.
|
60
|
-
#
|
61
|
-
# You can also create a new time using
|
62
|
-
# [::at](Time#method-c-at) which takes the number of
|
63
|
-
# seconds (or fraction of seconds) since the [Unix
|
64
|
-
# Epoch](http://en.wikipedia.org/wiki/Unix_time).
|
65
|
-
#
|
66
|
-
# ```ruby
|
67
|
-
# Time.at(628232400) #=> 1989-11-28 00:00:00 -0500
|
68
|
-
# ```
|
69
|
-
#
|
70
|
-
#
|
71
|
-
# Once you have an instance of [Time](Time) there is a
|
72
|
-
# multitude of things you can do with it. Below are some examples. For all
|
73
|
-
# of the following examples, we will work on the assumption that you have
|
74
|
-
# done the following:
|
75
|
-
#
|
76
|
-
# ```ruby
|
77
|
-
# t = Time.new(1993, 02, 24, 12, 0, 0, "+09:00")
|
78
|
-
# ```
|
79
|
-
#
|
80
|
-
# Was that a monday?
|
81
|
-
#
|
82
|
-
# ```ruby
|
83
|
-
# t.monday? #=> false
|
84
|
-
# ```
|
85
|
-
#
|
86
|
-
# What year was that again?
|
87
|
-
#
|
88
|
-
# ```ruby
|
89
|
-
# t.year #=> 1993
|
90
|
-
# ```
|
91
|
-
#
|
92
|
-
# Was it daylight savings at the time?
|
93
|
-
#
|
94
|
-
# ```ruby
|
95
|
-
# t.dst? #=> false
|
96
|
-
# ```
|
97
|
-
#
|
98
|
-
# What’s the day a year later?
|
99
|
-
#
|
100
|
-
# ```ruby
|
101
|
-
# t + (60*60*24*365) #=> 1994-02-24 12:00:00 +0900
|
102
|
-
# ```
|
103
|
-
#
|
104
|
-
# How many seconds was that since the Unix Epoch?
|
105
|
-
#
|
106
|
-
# ```ruby
|
107
|
-
# t.to_i #=> 730522800
|
108
|
-
# ```
|
109
|
-
#
|
110
|
-
# You can also do standard functions like compare two times.
|
111
|
-
#
|
112
|
-
# ```ruby
|
113
|
-
# t1 = Time.new(2010)
|
114
|
-
# t2 = Time.new(2011)
|
115
|
-
#
|
116
|
-
# t1 == t2 #=> false
|
117
|
-
# t1 == t1 #=> true
|
118
|
-
# t1 < t2 #=> true
|
119
|
-
# t1 > t2 #=> false
|
120
|
-
#
|
121
|
-
# Time.new(2010,10,31).between?(t1, t2) #=> true
|
122
|
-
# ```
|
123
|
-
#
|
124
|
-
#
|
125
|
-
# A timezone argument must have `local_to_utc` and `utc_to_local` methods,
|
126
|
-
# and may have `name` and `abbr` methods.
|
127
|
-
#
|
128
|
-
# The `local_to_utc` method should convert a Time-like object from the
|
129
|
-
# timezone to UTC, and `utc_to_local` is the opposite. The result also
|
130
|
-
# should be a [Time](Time) or Time-like object (not
|
131
|
-
# necessary to be the same class). The
|
132
|
-
# [zone](Time#method-i-zone) of the result is just
|
133
|
-
# ignored. Time-like argument to these methods is similar to a
|
134
|
-
# [Time](Time) object in UTC without sub-second; it
|
135
|
-
# has attribute readers for the parts, e.g.
|
136
|
-
# [year](Time#method-i-year),
|
137
|
-
# [month](Time#method-i-month), and so on, and epoch
|
138
|
-
# time readers, [to\_i](Time#method-i-to_i). The
|
139
|
-
# sub-second attributes are fixed as 0, and
|
140
|
-
# [utc\_offset](Time#method-i-utc_offset),
|
141
|
-
# [zone](Time#method-i-zone),
|
142
|
-
# [isdst](Time#method-i-isdst), and their aliases are
|
143
|
-
# same as a [Time](Time) object in UTC. Also to\_time,
|
144
|
-
# \#+, and \#- methods are defined.
|
145
|
-
#
|
146
|
-
# The `name` method is used for marshaling. If this method is not defined
|
147
|
-
# on a timezone object, [Time](Time) objects using
|
148
|
-
# that timezone object can not be dumped by
|
149
|
-
# [Marshal](https://ruby-doc.org/core-2.6.3/Marshal.html).
|
150
|
-
#
|
151
|
-
# The `abbr` method is used by ‘%Z’ in
|
152
|
-
# [strftime](Time#method-i-strftime).
|
153
|
-
#
|
154
|
-
#
|
155
|
-
# At loading marshaled data, a timezone name will be converted to a
|
156
|
-
# timezone object by `find_timezone` class method, if the method is
|
157
|
-
# defined.
|
158
|
-
#
|
159
|
-
# Similary, that class method will be called when a timezone argument does
|
160
|
-
# not have the necessary methods mentioned above.
|
161
|
-
class Time < Object
|
162
|
-
include Comparable
|
163
|
-
|
164
|
-
def self.at: (Time | Numeric seconds) -> Time
|
165
|
-
| (Numeric seconds, ?Numeric microseconds_with_frac) -> Time
|
166
|
-
|
167
|
-
def self.gm: (Integer year, ?Integer | String month, ?Integer day, ?Integer hour, ?Integer min, ?Numeric sec, ?Numeric usec_with_frac) -> Time
|
168
|
-
|
169
|
-
def self.local: (Integer year, ?Integer | String month, ?Integer day, ?Integer hour, ?Integer min, ?Numeric sec, ?Numeric usec_with_frac) -> Time
|
170
|
-
|
171
|
-
# Creates a new [Time](Time.downloaded.ruby_doc) object for the current
|
172
|
-
# time. This is same as [::new](Time.downloaded.ruby_doc#method-c-new)
|
173
|
-
# without arguments.
|
174
|
-
#
|
175
|
-
# ```ruby
|
176
|
-
# Time.now #=> 2009-06-24 12:39:54 +0900
|
177
|
-
# ```
|
178
|
-
def self.now: () -> Time
|
179
|
-
|
180
|
-
def self.utc: (Integer year, ?Integer | String month, ?Integer day, ?Integer hour, ?Integer min, ?Numeric sec, ?Numeric usec_with_frac) -> Time
|
181
|
-
|
182
|
-
def +: (Numeric arg0) -> Time
|
183
|
-
|
184
|
-
def -: (Time arg0) -> Float
|
185
|
-
| (Numeric arg0) -> Time
|
186
|
-
|
187
|
-
def <: (Time arg0) -> bool
|
188
|
-
|
189
|
-
def <=: (Time arg0) -> bool
|
190
|
-
|
191
|
-
def <=>: (Time other) -> Integer?
|
192
|
-
|
193
|
-
def >: (Time arg0) -> bool
|
194
|
-
|
195
|
-
def >=: (Time arg0) -> bool
|
196
|
-
|
197
|
-
# Returns a canonical string representation of *time* .
|
198
|
-
#
|
199
|
-
# ```ruby
|
200
|
-
# Time.now.asctime #=> "Wed Apr 9 08:56:03 2003"
|
201
|
-
# Time.now.ctime #=> "Wed Apr 9 08:56:03 2003"
|
202
|
-
# ```
|
203
|
-
def asctime: () -> String
|
204
|
-
|
205
|
-
# Returns a canonical string representation of *time* .
|
206
|
-
#
|
207
|
-
# ```ruby
|
208
|
-
# Time.now.asctime #=> "Wed Apr 9 08:56:03 2003"
|
209
|
-
# Time.now.ctime #=> "Wed Apr 9 08:56:03 2003"
|
210
|
-
# ```
|
211
|
-
def ctime: () -> String
|
212
|
-
|
213
|
-
# Returns the day of the month (1..n) for *time* .
|
214
|
-
#
|
215
|
-
# ```ruby
|
216
|
-
# t = Time.now #=> 2007-11-19 08:27:03 -0600
|
217
|
-
# t.day #=> 19
|
218
|
-
# t.mday #=> 19
|
219
|
-
# ```
|
220
|
-
def day: () -> Integer
|
221
|
-
|
222
|
-
# Returns `true` if *time* occurs during Daylight Saving
|
223
|
-
# [Time](Time.downloaded.ruby_doc) in its time zone.
|
224
|
-
#
|
225
|
-
# ```ruby
|
226
|
-
# # CST6CDT:
|
227
|
-
# Time.local(2000, 1, 1).zone #=> "CST"
|
228
|
-
# Time.local(2000, 1, 1).isdst #=> false
|
229
|
-
# Time.local(2000, 1, 1).dst? #=> false
|
230
|
-
# Time.local(2000, 7, 1).zone #=> "CDT"
|
231
|
-
# Time.local(2000, 7, 1).isdst #=> true
|
232
|
-
# Time.local(2000, 7, 1).dst? #=> true
|
233
|
-
#
|
234
|
-
# # Asia/Tokyo:
|
235
|
-
# Time.local(2000, 1, 1).zone #=> "JST"
|
236
|
-
# Time.local(2000, 1, 1).isdst #=> false
|
237
|
-
# Time.local(2000, 1, 1).dst? #=> false
|
238
|
-
# Time.local(2000, 7, 1).zone #=> "JST"
|
239
|
-
# Time.local(2000, 7, 1).isdst #=> false
|
240
|
-
# Time.local(2000, 7, 1).dst? #=> false
|
241
|
-
# ```
|
242
|
-
def dst?: () -> bool
|
243
|
-
|
244
|
-
def eql?: (untyped arg0) -> bool
|
245
|
-
|
246
|
-
# Returns `true` if *time* represents Friday.
|
247
|
-
#
|
248
|
-
# ```ruby
|
249
|
-
# t = Time.local(1987, 12, 18) #=> 1987-12-18 00:00:00 -0600
|
250
|
-
# t.friday? #=> true
|
251
|
-
# ```
|
252
|
-
def friday?: () -> bool
|
253
|
-
|
254
|
-
# Returns a new [Time](Time.downloaded.ruby_doc) object representing
|
255
|
-
# *time* in UTC.
|
256
|
-
#
|
257
|
-
# ```ruby
|
258
|
-
# t = Time.local(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 -0600
|
259
|
-
# t.gmt? #=> false
|
260
|
-
# y = t.getgm #=> 2000-01-02 02:15:01 UTC
|
261
|
-
# y.gmt? #=> true
|
262
|
-
# t == y #=> true
|
263
|
-
# ```
|
264
|
-
def getgm: () -> Time
|
265
|
-
|
266
|
-
def getlocal: (?Integer utc_offset) -> Time
|
267
|
-
|
268
|
-
# Returns a new [Time](Time.downloaded.ruby_doc) object representing
|
269
|
-
# *time* in UTC.
|
270
|
-
#
|
271
|
-
# ```ruby
|
272
|
-
# t = Time.local(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 -0600
|
273
|
-
# t.gmt? #=> false
|
274
|
-
# y = t.getgm #=> 2000-01-02 02:15:01 UTC
|
275
|
-
# y.gmt? #=> true
|
276
|
-
# t == y #=> true
|
277
|
-
# ```
|
278
|
-
def getutc: () -> Time
|
279
|
-
|
280
|
-
# Returns `true` if *time* represents a time in UTC (GMT).
|
281
|
-
#
|
282
|
-
# ```ruby
|
283
|
-
# t = Time.now #=> 2007-11-19 08:15:23 -0600
|
284
|
-
# t.utc? #=> false
|
285
|
-
# t = Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
286
|
-
# t.utc? #=> true
|
287
|
-
#
|
288
|
-
# t = Time.now #=> 2007-11-19 08:16:03 -0600
|
289
|
-
# t.gmt? #=> false
|
290
|
-
# t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
291
|
-
# t.gmt? #=> true
|
292
|
-
# ```
|
293
|
-
def gmt?: () -> bool
|
294
|
-
|
295
|
-
# Returns the offset in seconds between the timezone of *time* and UTC.
|
296
|
-
#
|
297
|
-
# ```ruby
|
298
|
-
# t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
299
|
-
# t.gmt_offset #=> 0
|
300
|
-
# l = t.getlocal #=> 2000-01-01 14:15:01 -0600
|
301
|
-
# l.gmt_offset #=> -21600
|
302
|
-
# ```
|
303
|
-
def gmt_offset: () -> Integer
|
304
|
-
|
305
|
-
# Converts *time* to UTC (GMT), modifying the receiver.
|
306
|
-
#
|
307
|
-
# ```ruby
|
308
|
-
# t = Time.now #=> 2007-11-19 08:18:31 -0600
|
309
|
-
# t.gmt? #=> false
|
310
|
-
# t.gmtime #=> 2007-11-19 14:18:31 UTC
|
311
|
-
# t.gmt? #=> true
|
312
|
-
#
|
313
|
-
# t = Time.now #=> 2007-11-19 08:18:51 -0600
|
314
|
-
# t.utc? #=> false
|
315
|
-
# t.utc #=> 2007-11-19 14:18:51 UTC
|
316
|
-
# t.utc? #=> true
|
317
|
-
# ```
|
318
|
-
def gmtime: () -> Time
|
319
|
-
|
320
|
-
# Returns a hash code for this [Time](Time.downloaded.ruby_doc) object.
|
321
|
-
#
|
322
|
-
# See also Object\#hash.
|
323
|
-
def hash: () -> Integer
|
324
|
-
|
325
|
-
# Returns the hour of the day (0..23) for *time* .
|
326
|
-
#
|
327
|
-
# ```ruby
|
328
|
-
# t = Time.now #=> 2007-11-19 08:26:20 -0600
|
329
|
-
# t.hour #=> 8
|
330
|
-
# ```
|
331
|
-
def hour: () -> Integer
|
332
|
-
|
333
|
-
def initialize: (?Integer | String year, ?Integer | String month, ?Integer | String day, ?Integer | String hour, ?Integer | String min, ?Numeric | String sec, ?Numeric | String usec_with_frac) -> void
|
334
|
-
|
335
|
-
# Returns a string representing *time* . Equivalent to calling
|
336
|
-
# [strftime](Time.downloaded.ruby_doc#method-i-strftime) with the
|
337
|
-
# appropriate format string.
|
338
|
-
#
|
339
|
-
# ```ruby
|
340
|
-
# t = Time.now
|
341
|
-
# t.to_s #=> "2012-11-10 18:16:12 +0100"
|
342
|
-
# t.strftime "%Y-%m-%d %H:%M:%S %z" #=> "2012-11-10 18:16:12 +0100"
|
343
|
-
#
|
344
|
-
# t.utc.to_s #=> "2012-11-10 17:16:12 UTC"
|
345
|
-
# t.strftime "%Y-%m-%d %H:%M:%S UTC" #=> "2012-11-10 17:16:12 UTC"
|
346
|
-
# ```
|
347
|
-
def inspect: () -> String
|
348
|
-
|
349
|
-
# Returns `true` if *time* occurs during Daylight Saving
|
350
|
-
# [Time](Time.downloaded.ruby_doc) in its time zone.
|
351
|
-
#
|
352
|
-
# ```ruby
|
353
|
-
# # CST6CDT:
|
354
|
-
# Time.local(2000, 1, 1).zone #=> "CST"
|
355
|
-
# Time.local(2000, 1, 1).isdst #=> false
|
356
|
-
# Time.local(2000, 1, 1).dst? #=> false
|
357
|
-
# Time.local(2000, 7, 1).zone #=> "CDT"
|
358
|
-
# Time.local(2000, 7, 1).isdst #=> true
|
359
|
-
# Time.local(2000, 7, 1).dst? #=> true
|
360
|
-
#
|
361
|
-
# # Asia/Tokyo:
|
362
|
-
# Time.local(2000, 1, 1).zone #=> "JST"
|
363
|
-
# Time.local(2000, 1, 1).isdst #=> false
|
364
|
-
# Time.local(2000, 1, 1).dst? #=> false
|
365
|
-
# Time.local(2000, 7, 1).zone #=> "JST"
|
366
|
-
# Time.local(2000, 7, 1).isdst #=> false
|
367
|
-
# Time.local(2000, 7, 1).dst? #=> false
|
368
|
-
# ```
|
369
|
-
def isdst: () -> bool
|
370
|
-
|
371
|
-
def localtime: (?String utc_offset) -> Time
|
372
|
-
|
373
|
-
# Returns the day of the month (1..n) for *time* .
|
374
|
-
#
|
375
|
-
# ```ruby
|
376
|
-
# t = Time.now #=> 2007-11-19 08:27:03 -0600
|
377
|
-
# t.day #=> 19
|
378
|
-
# t.mday #=> 19
|
379
|
-
# ```
|
380
|
-
def mday: () -> Integer
|
381
|
-
|
382
|
-
# Returns the minute of the hour (0..59) for *time* .
|
383
|
-
#
|
384
|
-
# ```ruby
|
385
|
-
# t = Time.now #=> 2007-11-19 08:25:51 -0600
|
386
|
-
# t.min #=> 25
|
387
|
-
# ```
|
388
|
-
def min: () -> Integer
|
389
|
-
|
390
|
-
# Returns the month of the year (1..12) for *time* .
|
391
|
-
#
|
392
|
-
# ```ruby
|
393
|
-
# t = Time.now #=> 2007-11-19 08:27:30 -0600
|
394
|
-
# t.mon #=> 11
|
395
|
-
# t.month #=> 11
|
396
|
-
# ```
|
397
|
-
def mon: () -> Integer
|
398
|
-
|
399
|
-
# Returns `true` if *time* represents Monday.
|
400
|
-
#
|
401
|
-
# ```ruby
|
402
|
-
# t = Time.local(2003, 8, 4) #=> 2003-08-04 00:00:00 -0500
|
403
|
-
# t.monday? #=> true
|
404
|
-
# ```
|
405
|
-
def monday?: () -> bool
|
406
|
-
|
407
|
-
# Returns the number of nanoseconds for *time* .
|
408
|
-
#
|
409
|
-
# ```ruby
|
410
|
-
# t = Time.now #=> 2007-11-17 15:18:03 +0900
|
411
|
-
# "%10.9f" % t.to_f #=> "1195280283.536151409"
|
412
|
-
# t.nsec #=> 536151406
|
413
|
-
# ```
|
414
|
-
#
|
415
|
-
# The lowest digits of [to\_f](Time.downloaded.ruby_doc#method-i-to_f) and
|
416
|
-
# [nsec](Time.downloaded.ruby_doc#method-i-nsec) are different because
|
417
|
-
# IEEE 754 double is not accurate enough to represent the exact number of
|
418
|
-
# nanoseconds since the Epoch.
|
419
|
-
#
|
420
|
-
# The more accurate value is returned by
|
421
|
-
# [nsec](Time.downloaded.ruby_doc#method-i-nsec).
|
422
|
-
def nsec: () -> Integer
|
423
|
-
|
424
|
-
def round: (Integer arg0) -> Time
|
425
|
-
|
426
|
-
# Returns `true` if *time* represents Saturday.
|
427
|
-
#
|
428
|
-
# ```ruby
|
429
|
-
# t = Time.local(2006, 6, 10) #=> 2006-06-10 00:00:00 -0500
|
430
|
-
# t.saturday? #=> true
|
431
|
-
# ```
|
432
|
-
def saturday?: () -> bool
|
433
|
-
|
434
|
-
# Returns the second of the minute (0..60) for *time* .
|
435
|
-
#
|
436
|
-
# **Note:** Seconds range from zero to 60 to allow the system to inject
|
437
|
-
# leap seconds. See
|
438
|
-
# [en.wikipedia.org/wiki/Leap\_second](http://en.wikipedia.org/wiki/Leap_second)
|
439
|
-
# for further details.
|
440
|
-
#
|
441
|
-
# ```ruby
|
442
|
-
# t = Time.now #=> 2007-11-19 08:25:02 -0600
|
443
|
-
# t.sec #=> 2
|
444
|
-
# ```
|
445
|
-
def sec: () -> Integer
|
446
|
-
|
447
|
-
def strftime: (String arg0) -> String
|
448
|
-
|
449
|
-
# Returns the fraction for *time* .
|
450
|
-
#
|
451
|
-
# The return value can be a rational number.
|
452
|
-
#
|
453
|
-
# ```ruby
|
454
|
-
# t = Time.now #=> 2009-03-26 22:33:12 +0900
|
455
|
-
# "%10.9f" % t.to_f #=> "1238074392.940563917"
|
456
|
-
# t.subsec #=> (94056401/100000000)
|
457
|
-
# ```
|
458
|
-
#
|
459
|
-
# The lowest digits of [to\_f](Time.downloaded.ruby_doc#method-i-to_f) and
|
460
|
-
# [subsec](Time.downloaded.ruby_doc#method-i-subsec) are different because
|
461
|
-
# IEEE 754 double is not accurate enough to represent the rational number.
|
462
|
-
#
|
463
|
-
# The more accurate value is returned by
|
464
|
-
# [subsec](Time.downloaded.ruby_doc#method-i-subsec).
|
465
|
-
def subsec: () -> Numeric
|
466
|
-
|
467
|
-
# Returns a new [Time](Time.downloaded.ruby_doc) object, one second later
|
468
|
-
# than *time* . [\#succ](Time.downloaded.ruby_doc#method-i-succ) is
|
469
|
-
# obsolete since 1.9.2 for time is not a discrete value.
|
470
|
-
#
|
471
|
-
# ```ruby
|
472
|
-
# t = Time.now #=> 2007-11-19 08:23:57 -0600
|
473
|
-
# t.succ #=> 2007-11-19 08:23:58 -0600
|
474
|
-
# ```
|
475
|
-
#
|
476
|
-
# Use instead `time + 1`
|
477
|
-
#
|
478
|
-
# ```ruby
|
479
|
-
# t + 1 #=> 2007-11-19 08:23:58 -0600
|
480
|
-
# ```
|
481
|
-
def succ: () -> Time
|
482
|
-
|
483
|
-
# Returns `true` if *time* represents Sunday.
|
484
|
-
#
|
485
|
-
# ```ruby
|
486
|
-
# t = Time.local(1990, 4, 1) #=> 1990-04-01 00:00:00 -0600
|
487
|
-
# t.sunday? #=> true
|
488
|
-
# ```
|
489
|
-
def sunday?: () -> bool
|
490
|
-
|
491
|
-
# Returns `true` if *time* represents Thursday.
|
492
|
-
#
|
493
|
-
# ```ruby
|
494
|
-
# t = Time.local(1995, 12, 21) #=> 1995-12-21 00:00:00 -0600
|
495
|
-
# t.thursday? #=> true
|
496
|
-
# ```
|
497
|
-
def thursday?: () -> bool
|
498
|
-
|
499
|
-
# Returns a ten-element *array* of values for *time* :
|
500
|
-
#
|
501
|
-
# ```ruby
|
502
|
-
# [sec, min, hour, day, month, year, wday, yday, isdst, zone]
|
503
|
-
# ```
|
504
|
-
#
|
505
|
-
# See the individual methods for an explanation of the valid ranges of
|
506
|
-
# each value. The ten elements can be passed directly to
|
507
|
-
# [::utc](Time.downloaded.ruby_doc#method-c-utc) or
|
508
|
-
# [::local](Time.downloaded.ruby_doc#method-c-local) to create a new
|
509
|
-
# [Time](Time.downloaded.ruby_doc) object.
|
510
|
-
#
|
511
|
-
# ```ruby
|
512
|
-
# t = Time.now #=> 2007-11-19 08:36:01 -0600
|
513
|
-
# now = t.to_a #=> [1, 36, 8, 19, 11, 2007, 1, 323, false, "CST"]
|
514
|
-
# ```
|
515
|
-
def to_a: () -> [ Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, bool, String ]
|
516
|
-
|
517
|
-
# Returns the value of *time* as a floating point number of seconds since
|
518
|
-
# the Epoch.
|
519
|
-
#
|
520
|
-
# ```ruby
|
521
|
-
# t = Time.now
|
522
|
-
# "%10.5f" % t.to_f #=> "1270968744.77658"
|
523
|
-
# t.to_i #=> 1270968744
|
524
|
-
# ```
|
525
|
-
#
|
526
|
-
# Note that IEEE 754 double is not accurate enough to represent the exact
|
527
|
-
# number of nanoseconds since the Epoch.
|
528
|
-
def to_f: () -> Float
|
529
|
-
|
530
|
-
# Returns the value of *time* as an integer number of seconds since the
|
531
|
-
# Epoch.
|
532
|
-
#
|
533
|
-
# ```ruby
|
534
|
-
# t = Time.now
|
535
|
-
# "%10.5f" % t.to_f #=> "1270968656.89607"
|
536
|
-
# t.to_i #=> 1270968656
|
537
|
-
# ```
|
538
|
-
def to_i: () -> Integer
|
539
|
-
|
540
|
-
# Returns the value of *time* as a rational number of seconds since the
|
541
|
-
# Epoch.
|
542
|
-
#
|
543
|
-
# ```ruby
|
544
|
-
# t = Time.now
|
545
|
-
# t.to_r #=> (1270968792716287611/1000000000)
|
546
|
-
# ```
|
547
|
-
#
|
548
|
-
# This methods is intended to be used to get an accurate value
|
549
|
-
# representing the nanoseconds since the Epoch. You can use this method to
|
550
|
-
# convert *time* to another Epoch.
|
551
|
-
def to_r: () -> Rational
|
552
|
-
|
553
|
-
# Returns a string representing *time* . Equivalent to calling
|
554
|
-
# [strftime](Time.downloaded.ruby_doc#method-i-strftime) with the
|
555
|
-
# appropriate format string.
|
556
|
-
#
|
557
|
-
# ```ruby
|
558
|
-
# t = Time.now
|
559
|
-
# t.to_s #=> "2012-11-10 18:16:12 +0100"
|
560
|
-
# t.strftime "%Y-%m-%d %H:%M:%S %z" #=> "2012-11-10 18:16:12 +0100"
|
561
|
-
#
|
562
|
-
# t.utc.to_s #=> "2012-11-10 17:16:12 UTC"
|
563
|
-
# t.strftime "%Y-%m-%d %H:%M:%S UTC" #=> "2012-11-10 17:16:12 UTC"
|
564
|
-
# ```
|
565
|
-
def to_s: () -> String
|
566
|
-
|
567
|
-
# Returns `true` if *time* represents Tuesday.
|
568
|
-
#
|
569
|
-
# ```ruby
|
570
|
-
# t = Time.local(1991, 2, 19) #=> 1991-02-19 00:00:00 -0600
|
571
|
-
# t.tuesday? #=> true
|
572
|
-
# ```
|
573
|
-
def tuesday?: () -> bool
|
574
|
-
|
575
|
-
# Returns the number of nanoseconds for *time* .
|
576
|
-
#
|
577
|
-
# ```ruby
|
578
|
-
# t = Time.now #=> 2007-11-17 15:18:03 +0900
|
579
|
-
# "%10.9f" % t.to_f #=> "1195280283.536151409"
|
580
|
-
# t.nsec #=> 536151406
|
581
|
-
# ```
|
582
|
-
#
|
583
|
-
# The lowest digits of [to\_f](Time.downloaded.ruby_doc#method-i-to_f) and
|
584
|
-
# [nsec](Time.downloaded.ruby_doc#method-i-nsec) are different because
|
585
|
-
# IEEE 754 double is not accurate enough to represent the exact number of
|
586
|
-
# nanoseconds since the Epoch.
|
587
|
-
#
|
588
|
-
# The more accurate value is returned by
|
589
|
-
# [nsec](Time.downloaded.ruby_doc#method-i-nsec).
|
590
|
-
def tv_nsec: () -> Numeric
|
591
|
-
|
592
|
-
# Returns the value of *time* as an integer number of seconds since the
|
593
|
-
# Epoch.
|
594
|
-
#
|
595
|
-
# ```ruby
|
596
|
-
# t = Time.now
|
597
|
-
# "%10.5f" % t.to_f #=> "1270968656.89607"
|
598
|
-
# t.to_i #=> 1270968656
|
599
|
-
# ```
|
600
|
-
def tv_sec: () -> Numeric
|
601
|
-
|
602
|
-
# Returns the number of microseconds for *time* .
|
603
|
-
#
|
604
|
-
# ```ruby
|
605
|
-
# t = Time.now #=> 2007-11-19 08:03:26 -0600
|
606
|
-
# "%10.6f" % t.to_f #=> "1195481006.775195"
|
607
|
-
# t.usec #=> 775195
|
608
|
-
# ```
|
609
|
-
def tv_usec: () -> Numeric
|
610
|
-
|
611
|
-
# Returns the number of microseconds for *time* .
|
612
|
-
#
|
613
|
-
# ```ruby
|
614
|
-
# t = Time.now #=> 2007-11-19 08:03:26 -0600
|
615
|
-
# "%10.6f" % t.to_f #=> "1195481006.775195"
|
616
|
-
# t.usec #=> 775195
|
617
|
-
# ```
|
618
|
-
def usec: () -> Numeric
|
619
|
-
|
620
|
-
# Converts *time* to UTC (GMT), modifying the receiver.
|
621
|
-
#
|
622
|
-
# ```ruby
|
623
|
-
# t = Time.now #=> 2007-11-19 08:18:31 -0600
|
624
|
-
# t.gmt? #=> false
|
625
|
-
# t.gmtime #=> 2007-11-19 14:18:31 UTC
|
626
|
-
# t.gmt? #=> true
|
627
|
-
#
|
628
|
-
# t = Time.now #=> 2007-11-19 08:18:51 -0600
|
629
|
-
# t.utc? #=> false
|
630
|
-
# t.utc #=> 2007-11-19 14:18:51 UTC
|
631
|
-
# t.utc? #=> true
|
632
|
-
# ```
|
633
|
-
def utc: () -> Time
|
634
|
-
|
635
|
-
# Returns `true` if *time* represents a time in UTC (GMT).
|
636
|
-
#
|
637
|
-
# ```ruby
|
638
|
-
# t = Time.now #=> 2007-11-19 08:15:23 -0600
|
639
|
-
# t.utc? #=> false
|
640
|
-
# t = Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
641
|
-
# t.utc? #=> true
|
642
|
-
#
|
643
|
-
# t = Time.now #=> 2007-11-19 08:16:03 -0600
|
644
|
-
# t.gmt? #=> false
|
645
|
-
# t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
646
|
-
# t.gmt? #=> true
|
647
|
-
# ```
|
648
|
-
def utc?: () -> bool
|
649
|
-
|
650
|
-
# Returns the offset in seconds between the timezone of *time* and UTC.
|
651
|
-
#
|
652
|
-
# ```ruby
|
653
|
-
# t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
654
|
-
# t.gmt_offset #=> 0
|
655
|
-
# l = t.getlocal #=> 2000-01-01 14:15:01 -0600
|
656
|
-
# l.gmt_offset #=> -21600
|
657
|
-
# ```
|
658
|
-
def utc_offset: () -> Integer
|
659
|
-
|
660
|
-
# Returns an integer representing the day of the week, 0..6, with Sunday
|
661
|
-
# == 0.
|
662
|
-
#
|
663
|
-
# ```ruby
|
664
|
-
# t = Time.now #=> 2007-11-20 02:35:35 -0600
|
665
|
-
# t.wday #=> 2
|
666
|
-
# t.sunday? #=> false
|
667
|
-
# t.monday? #=> false
|
668
|
-
# t.tuesday? #=> true
|
669
|
-
# t.wednesday? #=> false
|
670
|
-
# t.thursday? #=> false
|
671
|
-
# t.friday? #=> false
|
672
|
-
# t.saturday? #=> false
|
673
|
-
# ```
|
674
|
-
def wday: () -> Integer
|
675
|
-
|
676
|
-
# Returns `true` if *time* represents Wednesday.
|
677
|
-
#
|
678
|
-
# ```ruby
|
679
|
-
# t = Time.local(1993, 2, 24) #=> 1993-02-24 00:00:00 -0600
|
680
|
-
# t.wednesday? #=> true
|
681
|
-
# ```
|
682
|
-
def wednesday?: () -> bool
|
683
|
-
|
684
|
-
# Returns an integer representing the day of the year, 1..366.
|
685
|
-
#
|
686
|
-
# ```ruby
|
687
|
-
# t = Time.now #=> 2007-11-19 08:32:31 -0600
|
688
|
-
# t.yday #=> 323
|
689
|
-
# ```
|
690
|
-
def yday: () -> Integer
|
691
|
-
|
692
|
-
# Returns the year for *time* (including the century).
|
693
|
-
#
|
694
|
-
# ```ruby
|
695
|
-
# t = Time.now #=> 2007-11-19 08:27:51 -0600
|
696
|
-
# t.year #=> 2007
|
697
|
-
# ```
|
698
|
-
def year: () -> Integer
|
699
|
-
|
700
|
-
# Returns the name of the time zone used for *time* . As of Ruby 1.8,
|
701
|
-
# returns “UTC” rather than “GMT” for UTC times.
|
702
|
-
#
|
703
|
-
# ```ruby
|
704
|
-
# t = Time.gm(2000, "jan", 1, 20, 15, 1)
|
705
|
-
# t.zone #=> "UTC"
|
706
|
-
# t = Time.local(2000, "jan", 1, 20, 15, 1)
|
707
|
-
# t.zone #=> "CST"
|
708
|
-
# ```
|
709
|
-
def zone: () -> String
|
710
|
-
|
711
|
-
def self.mktime: (Integer year, ?Integer | String month, ?Integer day, ?Integer hour, ?Integer min, ?Numeric sec, ?Numeric usec_with_frac) -> Time
|
712
|
-
|
713
|
-
# Returns the offset in seconds between the timezone of *time* and UTC.
|
714
|
-
#
|
715
|
-
# ```ruby
|
716
|
-
# t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
|
717
|
-
# t.gmt_offset #=> 0
|
718
|
-
# l = t.getlocal #=> 2000-01-01 14:15:01 -0600
|
719
|
-
# l.gmt_offset #=> -21600
|
720
|
-
# ```
|
721
|
-
def gmtoff: () -> Integer
|
722
|
-
|
723
|
-
# Returns the month of the year (1..12) for *time* .
|
724
|
-
#
|
725
|
-
# ```ruby
|
726
|
-
# t = Time.now #=> 2007-11-19 08:27:30 -0600
|
727
|
-
# t.mon #=> 11
|
728
|
-
# t.month #=> 11
|
729
|
-
# ```
|
730
|
-
def month: () -> Integer
|
731
|
-
|
732
|
-
def floor: (?Integer ndigits) -> Time
|
733
|
-
|
734
|
-
def ceil: (?Integer ndigits) -> Time
|
735
|
-
end
|
736
|
-
|
737
|
-
Time::RFC2822_DAY_NAME: Array[String]
|
738
|
-
|
739
|
-
Time::RFC2822_MONTH_NAME: Array[String]
|