steep 0.16.0 → 0.17.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.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -3
  3. data/CHANGELOG.md +24 -0
  4. data/Rakefile +0 -13
  5. data/bin/setup +0 -2
  6. data/bin/smoke_runner.rb +0 -1
  7. data/exe/steep +0 -1
  8. data/lib/steep.rb +1 -1
  9. data/lib/steep/drivers/check.rb +1 -12
  10. data/lib/steep/drivers/watch.rb +2 -2
  11. data/lib/steep/project/file.rb +1 -1
  12. data/lib/steep/project/hover_content.rb +1 -1
  13. data/lib/steep/project/options.rb +15 -0
  14. data/lib/steep/server/code_worker.rb +4 -4
  15. data/lib/steep/server/signature_worker.rb +4 -4
  16. data/lib/steep/type_construction.rb +13 -19
  17. data/lib/steep/type_inference/constant_env.rb +2 -10
  18. data/lib/steep/type_inference/context.rb +1 -0
  19. data/lib/steep/version.rb +1 -1
  20. data/steep.gemspec +6 -7
  21. metadata +23 -146
  22. data/exe/rbs +0 -3
  23. data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
  24. data/vendor/ruby-signature/.gitignore +0 -12
  25. data/vendor/ruby-signature/.rubocop.yml +0 -15
  26. data/vendor/ruby-signature/BSDL +0 -22
  27. data/vendor/ruby-signature/COPYING +0 -56
  28. data/vendor/ruby-signature/Gemfile +0 -6
  29. data/vendor/ruby-signature/README.md +0 -93
  30. data/vendor/ruby-signature/Rakefile +0 -142
  31. data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -157
  32. data/vendor/ruby-signature/bin/console +0 -14
  33. data/vendor/ruby-signature/bin/query-rdoc +0 -103
  34. data/vendor/ruby-signature/bin/setup +0 -10
  35. data/vendor/ruby-signature/bin/sort +0 -89
  36. data/vendor/ruby-signature/bin/test_runner.rb +0 -16
  37. data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
  38. data/vendor/ruby-signature/docs/sigs.md +0 -148
  39. data/vendor/ruby-signature/docs/stdlib.md +0 -152
  40. data/vendor/ruby-signature/docs/syntax.md +0 -528
  41. data/vendor/ruby-signature/exe/rbs +0 -7
  42. data/vendor/ruby-signature/lib/rbs.rb +0 -64
  43. data/vendor/ruby-signature/lib/rbs/ast/annotation.rb +0 -27
  44. data/vendor/ruby-signature/lib/rbs/ast/comment.rb +0 -27
  45. data/vendor/ruby-signature/lib/rbs/ast/declarations.rb +0 -395
  46. data/vendor/ruby-signature/lib/rbs/ast/members.rb +0 -362
  47. data/vendor/ruby-signature/lib/rbs/buffer.rb +0 -50
  48. data/vendor/ruby-signature/lib/rbs/builtin_names.rb +0 -55
  49. data/vendor/ruby-signature/lib/rbs/cli.rb +0 -558
  50. data/vendor/ruby-signature/lib/rbs/constant.rb +0 -26
  51. data/vendor/ruby-signature/lib/rbs/constant_table.rb +0 -150
  52. data/vendor/ruby-signature/lib/rbs/definition.rb +0 -170
  53. data/vendor/ruby-signature/lib/rbs/definition_builder.rb +0 -919
  54. data/vendor/ruby-signature/lib/rbs/environment.rb +0 -281
  55. data/vendor/ruby-signature/lib/rbs/environment_loader.rb +0 -136
  56. data/vendor/ruby-signature/lib/rbs/environment_walker.rb +0 -124
  57. data/vendor/ruby-signature/lib/rbs/errors.rb +0 -187
  58. data/vendor/ruby-signature/lib/rbs/location.rb +0 -102
  59. data/vendor/ruby-signature/lib/rbs/method_type.rb +0 -123
  60. data/vendor/ruby-signature/lib/rbs/namespace.rb +0 -91
  61. data/vendor/ruby-signature/lib/rbs/parser.y +0 -1344
  62. data/vendor/ruby-signature/lib/rbs/prototype/rb.rb +0 -553
  63. data/vendor/ruby-signature/lib/rbs/prototype/rbi.rb +0 -587
  64. data/vendor/ruby-signature/lib/rbs/prototype/runtime.rb +0 -381
  65. data/vendor/ruby-signature/lib/rbs/substitution.rb +0 -46
  66. data/vendor/ruby-signature/lib/rbs/test.rb +0 -26
  67. data/vendor/ruby-signature/lib/rbs/test/errors.rb +0 -61
  68. data/vendor/ruby-signature/lib/rbs/test/hook.rb +0 -294
  69. data/vendor/ruby-signature/lib/rbs/test/setup.rb +0 -58
  70. data/vendor/ruby-signature/lib/rbs/test/spy.rb +0 -325
  71. data/vendor/ruby-signature/lib/rbs/test/test_helper.rb +0 -183
  72. data/vendor/ruby-signature/lib/rbs/test/type_check.rb +0 -254
  73. data/vendor/ruby-signature/lib/rbs/type_name.rb +0 -70
  74. data/vendor/ruby-signature/lib/rbs/types.rb +0 -936
  75. data/vendor/ruby-signature/lib/rbs/variance_calculator.rb +0 -138
  76. data/vendor/ruby-signature/lib/rbs/vendorer.rb +0 -47
  77. data/vendor/ruby-signature/lib/rbs/version.rb +0 -3
  78. data/vendor/ruby-signature/lib/rbs/writer.rb +0 -269
  79. data/vendor/ruby-signature/lib/ruby/signature.rb +0 -7
  80. data/vendor/ruby-signature/rbs.gemspec +0 -46
  81. data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -60
  82. data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -71
  83. data/vendor/ruby-signature/stdlib/benchmark/benchmark.rbs +0 -372
  84. data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
  85. data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
  86. data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
  87. data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -45
  88. data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
  89. data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
  90. data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
  91. data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
  92. data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
  93. data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
  94. data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -413
  95. data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -607
  96. data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
  97. data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
  98. data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
  99. data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
  100. data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -194
  101. data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
  102. data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
  103. data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
  104. data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -1076
  105. data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
  106. data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
  107. data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -243
  108. data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
  109. data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -707
  110. data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
  111. data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -576
  112. data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -161
  113. data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -271
  114. data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -369
  115. data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -185
  116. data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -1104
  117. data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
  118. data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
  119. data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
  120. data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -429
  121. data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -1227
  122. data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -267
  123. data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
  124. data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
  125. data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -57
  126. data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -1083
  127. data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
  128. data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
  129. data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -1901
  130. data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -284
  131. data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
  132. data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -228
  133. data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1108
  134. data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
  135. data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -1047
  136. data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -290
  137. data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
  138. data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -153
  139. data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
  140. data/vendor/ruby-signature/stdlib/coverage/coverage.rbs +0 -62
  141. data/vendor/ruby-signature/stdlib/csv/csv.rbs +0 -773
  142. data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -392
  143. data/vendor/ruby-signature/stdlib/find/find.rbs +0 -40
  144. data/vendor/ruby-signature/stdlib/ipaddr/ipaddr.rbs +0 -247
  145. data/vendor/ruby-signature/stdlib/json/json.rbs +0 -335
  146. data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -1093
  147. data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
  148. data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
  149. data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
  150. data/vendor/ruby-signature/stdlib/set/set.rbs +0 -301
  151. 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: () -> self
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,1047 +0,0 @@
1
- # Time is an abstraction of dates and times. Time is stored internally as the
2
- # number of seconds with fraction since the *Epoch*, January 1, 1970 00:00 UTC.
3
- # Also see the library module Date. The Time class treats GMT (Greenwich Mean
4
- # Time) and UTC (Coordinated Universal Time) as equivalent. GMT is the older way
5
- # of referring to these baseline times but persists in the names of calls on
6
- # POSIX systems.
7
- #
8
- # All times may have fraction. Be aware of this fact when comparing times with
9
- # each other -- times that are apparently equal when displayed may be different
10
- # when compared.
11
- #
12
- # Since Ruby 1.9.2, Time implementation uses a signed 63 bit integer, Bignum or
13
- # Rational. The integer is a number of nanoseconds since the *Epoch* which can
14
- # represent 1823-11-12 to 2116-02-20. When Bignum or Rational is used (before
15
- # 1823, after 2116, under nanosecond), Time works slower as when integer is
16
- # used.
17
- #
18
- # # Examples
19
- #
20
- # All of these examples were done using the EST timezone which is GMT-5.
21
- #
22
- # ## Creating a new Time instance
23
- #
24
- # You can create a new instance of Time with Time::new. This will use the
25
- # current system time. Time::now is an alias for this. You can also pass parts
26
- # of the time to Time::new such as year, month, minute, etc. When you want to
27
- # construct a time this way you must pass at least a year. If you pass the year
28
- # with nothing else time will default to January 1 of that year at 00:00:00 with
29
- # the current system timezone. Here are some examples:
30
- #
31
- # Time.new(2002) #=> 2002-01-01 00:00:00 -0500
32
- # Time.new(2002, 10) #=> 2002-10-01 00:00:00 -0500
33
- # Time.new(2002, 10, 31) #=> 2002-10-31 00:00:00 -0500
34
- #
35
- # You can pass a UTC offset:
36
- #
37
- # Time.new(2002, 10, 31, 2, 2, 2, "+02:00") #=> 2002-10-31 02:02:02 +0200
38
- #
39
- # Or a timezone object:
40
- #
41
- # tz = timezone("Europe/Athens") # Eastern European Time, UTC+2
42
- # Time.new(2002, 10, 31, 2, 2, 2, tz) #=> 2002-10-31 02:02:02 +0200
43
- #
44
- # You can also use Time::gm, Time::local and Time::utc to infer GMT, local and
45
- # UTC timezones instead of using the current system setting.
46
- #
47
- # You can also create a new time using Time::at which takes the number of
48
- # seconds (or fraction of seconds) since the [Unix
49
- # Epoch](http://en.wikipedia.org/wiki/Unix_time).
50
- #
51
- # Time.at(628232400) #=> 1989-11-28 00:00:00 -0500
52
- #
53
- # ## Working with an instance of Time
54
- #
55
- # Once you have an instance of Time there is a multitude of things you can do
56
- # with it. Below are some examples. For all of the following examples, we will
57
- # work on the assumption that you have done the following:
58
- #
59
- # t = Time.new(1993, 02, 24, 12, 0, 0, "+09:00")
60
- #
61
- # Was that a monday?
62
- #
63
- # t.monday? #=> false
64
- #
65
- # What year was that again?
66
- #
67
- # t.year #=> 1993
68
- #
69
- # Was it daylight savings at the time?
70
- #
71
- # t.dst? #=> false
72
- #
73
- # What's the day a year later?
74
- #
75
- # t + (60*60*24*365) #=> 1994-02-24 12:00:00 +0900
76
- #
77
- # How many seconds was that since the Unix Epoch?
78
- #
79
- # t.to_i #=> 730522800
80
- #
81
- # You can also do standard functions like compare two times.
82
- #
83
- # t1 = Time.new(2010)
84
- # t2 = Time.new(2011)
85
- #
86
- # t1 == t2 #=> false
87
- # t1 == t1 #=> true
88
- # t1 < t2 #=> true
89
- # t1 > t2 #=> false
90
- #
91
- # Time.new(2010,10,31).between?(t1, t2) #=> true
92
- #
93
- # ## Timezone argument
94
- #
95
- # A timezone argument must have `local_to_utc` and `utc_to_local` methods, and
96
- # may have `name`, `abbr`, and `dst?` methods.
97
- #
98
- # The `local_to_utc` method should convert a Time-like object from the timezone
99
- # to UTC, and `utc_to_local` is the opposite. The result also should be a Time
100
- # or Time-like object (not necessary to be the same class). The #zone of the
101
- # result is just ignored. Time-like argument to these methods is similar to a
102
- # Time object in UTC without sub-second; it has attribute readers for the parts,
103
- # e.g. #year, #month, and so on, and epoch time readers, #to_i. The sub-second
104
- # attributes are fixed as 0, and #utc_offset, #zone, #isdst, and their aliases
105
- # are same as a Time object in UTC. Also #to_time, #+, and #- methods are
106
- # defined.
107
- #
108
- # The `name` method is used for marshaling. If this method is not defined on a
109
- # timezone object, Time objects using that timezone object can not be dumped by
110
- # Marshal.
111
- #
112
- # The `abbr` method is used by '%Z' in #strftime.
113
- #
114
- # The `dst?` method is called with a `Time` value and should return whether the
115
- # `Time` value is in daylight savings time in the zone.
116
- #
117
- # ### Auto conversion to Timezone
118
- #
119
- # At loading marshaled data, a timezone name will be converted to a timezone
120
- # object by `find_timezone` class method, if the method is defined.
121
- #
122
- # Similarly, that class method will be called when a timezone argument does not
123
- # have the necessary methods mentioned above.
124
- #
125
- class Time < Object
126
- include Comparable
127
-
128
- # Creates a new Time object with the value given by `time`, the given number of
129
- # `seconds_with_frac`, or `seconds` and `microseconds_with_frac` since the
130
- # Epoch. `seconds_with_frac` and `microseconds_with_frac` can be an Integer,
131
- # Float, Rational, or other Numeric. non-portable feature allows the offset to
132
- # be negative on some systems.
133
- #
134
- # If `in` argument is given, the result is in that timezone or UTC offset, or if
135
- # a numeric argument is given, the result is in local time.
136
- #
137
- # Time.at(0) #=> 1969-12-31 18:00:00 -0600
138
- # Time.at(Time.at(0)) #=> 1969-12-31 18:00:00 -0600
139
- # Time.at(946702800) #=> 1999-12-31 23:00:00 -0600
140
- # Time.at(-284061600) #=> 1960-12-31 00:00:00 -0600
141
- # Time.at(946684800.2).usec #=> 200000
142
- # Time.at(946684800, 123456.789).nsec #=> 123456789
143
- # Time.at(946684800, 123456789, :nsec).nsec #=> 123456789
144
- #
145
- def self.at: (Time | Numeric seconds) -> Time
146
- | (Numeric seconds, ?Numeric microseconds_with_frac) -> Time
147
-
148
- # Creates a Time object based on given values, interpreted as UTC (GMT). The
149
- # year must be specified. Other values default to the minimum value for that
150
- # field (and may be `nil` or omitted). Months may be specified by numbers from 1
151
- # to 12, or by the three-letter English month names. Hours are specified on a
152
- # 24-hour clock (0..23). Raises an ArgumentError if any values are out of range.
153
- # Will also accept ten arguments in the order output by Time#to_a.
154
- #
155
- # `sec_with_frac` and `usec_with_frac` can have a fractional part.
156
- #
157
- # Time.utc(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
158
- # Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
159
- #
160
- def self.gm: (Integer year, ?Integer | String month, ?Integer day, ?Integer hour, ?Integer min, ?Numeric sec, ?Numeric usec_with_frac) -> Time
161
-
162
- # Same as Time::gm, but interprets the values in the local time zone.
163
- #
164
- # Time.local(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 -0600
165
- #
166
- def self.local: (Integer year, ?Integer | String month, ?Integer day, ?Integer hour, ?Integer min, ?Numeric sec, ?Numeric usec_with_frac) -> Time
167
-
168
- # Creates a new Time object for the current time. This is same as Time.new
169
- # without arguments.
170
- #
171
- # Time.now #=> 2009-06-24 12:39:54 +0900
172
- #
173
- def self.now: () -> Time
174
-
175
- # Creates a Time object based on given values, interpreted as UTC (GMT). The
176
- # year must be specified. Other values default to the minimum value for that
177
- # field (and may be `nil` or omitted). Months may be specified by numbers from 1
178
- # to 12, or by the three-letter English month names. Hours are specified on a
179
- # 24-hour clock (0..23). Raises an ArgumentError if any values are out of range.
180
- # Will also accept ten arguments in the order output by Time#to_a.
181
- #
182
- # `sec_with_frac` and `usec_with_frac` can have a fractional part.
183
- #
184
- # Time.utc(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
185
- # Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
186
- #
187
- def self.utc: (Integer year, ?Integer | String month, ?Integer day, ?Integer hour, ?Integer min, ?Numeric sec, ?Numeric usec_with_frac) -> Time
188
-
189
- # Addition --- Adds some number of seconds (possibly fractional) to *time* and
190
- # returns that value as a new Time object.
191
- #
192
- # t = Time.now #=> 2007-11-19 08:22:21 -0600
193
- # t + (60 * 60 * 24) #=> 2007-11-20 08:22:21 -0600
194
- #
195
- def +: (Numeric arg0) -> Time
196
-
197
- # Difference --- Returns a difference in seconds as a Float between *time* and
198
- # `other_time`, or subtracts the given number of seconds in `numeric` from
199
- # *time*.
200
- #
201
- # t = Time.now #=> 2007-11-19 08:23:10 -0600
202
- # t2 = t + 2592000 #=> 2007-12-19 08:23:10 -0600
203
- # t2 - t #=> 2592000.0
204
- # t2 - 2592000 #=> 2007-11-19 08:23:10 -0600
205
- #
206
- def -: (Time arg0) -> Float
207
- | (Numeric arg0) -> Time
208
-
209
- def <: (Time arg0) -> bool
210
-
211
- def <=: (Time arg0) -> bool
212
-
213
- # Comparison---Compares `time` with `other_time`.
214
- #
215
- # -1, 0, +1 or nil depending on whether `time` is less than, equal to, or
216
- # greater than `other_time`.
217
- #
218
- # `nil` is returned if the two values are incomparable.
219
- #
220
- # t = Time.now #=> 2007-11-19 08:12:12 -0600
221
- # t2 = t + 2592000 #=> 2007-12-19 08:12:12 -0600
222
- # t <=> t2 #=> -1
223
- # t2 <=> t #=> 1
224
- #
225
- # t = Time.now #=> 2007-11-19 08:13:38 -0600
226
- # t2 = t + 0.1 #=> 2007-11-19 08:13:38 -0600
227
- # t.nsec #=> 98222999
228
- # t2.nsec #=> 198222999
229
- # t <=> t2 #=> -1
230
- # t2 <=> t #=> 1
231
- # t <=> t #=> 0
232
- #
233
- def <=>: (Time other) -> Integer?
234
-
235
- def >: (Time arg0) -> bool
236
-
237
- def >=: (Time arg0) -> bool
238
-
239
- # Returns a canonical string representation of *time*.
240
- #
241
- # Time.now.asctime #=> "Wed Apr 9 08:56:03 2003"
242
- # Time.now.ctime #=> "Wed Apr 9 08:56:03 2003"
243
- #
244
- def asctime: () -> String
245
-
246
- # Returns a canonical string representation of *time*.
247
- #
248
- # Time.now.asctime #=> "Wed Apr 9 08:56:03 2003"
249
- # Time.now.ctime #=> "Wed Apr 9 08:56:03 2003"
250
- #
251
- def ctime: () -> String
252
-
253
- # Returns the day of the month (1..n) for *time*.
254
- #
255
- # t = Time.now #=> 2007-11-19 08:27:03 -0600
256
- # t.day #=> 19
257
- # t.mday #=> 19
258
- #
259
- def day: () -> Integer
260
-
261
- # Returns `true` if *time* occurs during Daylight Saving Time in its time zone.
262
- #
263
- # # CST6CDT:
264
- # Time.local(2000, 1, 1).zone #=> "CST"
265
- # Time.local(2000, 1, 1).isdst #=> false
266
- # Time.local(2000, 1, 1).dst? #=> false
267
- # Time.local(2000, 7, 1).zone #=> "CDT"
268
- # Time.local(2000, 7, 1).isdst #=> true
269
- # Time.local(2000, 7, 1).dst? #=> true
270
- #
271
- # # Asia/Tokyo:
272
- # Time.local(2000, 1, 1).zone #=> "JST"
273
- # Time.local(2000, 1, 1).isdst #=> false
274
- # Time.local(2000, 1, 1).dst? #=> false
275
- # Time.local(2000, 7, 1).zone #=> "JST"
276
- # Time.local(2000, 7, 1).isdst #=> false
277
- # Time.local(2000, 7, 1).dst? #=> false
278
- #
279
- def dst?: () -> bool
280
-
281
- # Returns `true` if *time* and `other_time` are both Time objects with the same
282
- # seconds and fractional seconds.
283
- #
284
- def eql?: (untyped arg0) -> bool
285
-
286
- # Returns `true` if *time* represents Friday.
287
- #
288
- # t = Time.local(1987, 12, 18) #=> 1987-12-18 00:00:00 -0600
289
- # t.friday? #=> true
290
- #
291
- def friday?: () -> bool
292
-
293
- # Returns a new Time object representing *time* in UTC.
294
- #
295
- # t = Time.local(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 -0600
296
- # t.gmt? #=> false
297
- # y = t.getgm #=> 2000-01-02 02:15:01 UTC
298
- # y.gmt? #=> true
299
- # t == y #=> true
300
- #
301
- def getgm: () -> Time
302
-
303
- # Returns a new Time object representing *time* in local time (using the local
304
- # time zone in effect for this process).
305
- #
306
- # If `utc_offset` is given, it is used instead of the local time. `utc_offset`
307
- # can be given as a human-readable string (eg. `"+09:00"`) or as a number of
308
- # seconds (eg. `32400`).
309
- #
310
- # t = Time.utc(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
311
- # t.utc? #=> true
312
- #
313
- # l = t.getlocal #=> 2000-01-01 14:15:01 -0600
314
- # l.utc? #=> false
315
- # t == l #=> true
316
- #
317
- # j = t.getlocal("+09:00") #=> 2000-01-02 05:15:01 +0900
318
- # j.utc? #=> false
319
- # t == j #=> true
320
- #
321
- # k = t.getlocal(9*60*60) #=> 2000-01-02 05:15:01 +0900
322
- # k.utc? #=> false
323
- # t == k #=> true
324
- #
325
- def getlocal: (?Integer utc_offset) -> Time
326
-
327
- # Returns a new Time object representing *time* in UTC.
328
- #
329
- # t = Time.local(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 -0600
330
- # t.gmt? #=> false
331
- # y = t.getgm #=> 2000-01-02 02:15:01 UTC
332
- # y.gmt? #=> true
333
- # t == y #=> true
334
- #
335
- def getutc: () -> Time
336
-
337
- # Returns `true` if *time* represents a time in UTC (GMT).
338
- #
339
- # t = Time.now #=> 2007-11-19 08:15:23 -0600
340
- # t.utc? #=> false
341
- # t = Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
342
- # t.utc? #=> true
343
- #
344
- # t = Time.now #=> 2007-11-19 08:16:03 -0600
345
- # t.gmt? #=> false
346
- # t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
347
- # t.gmt? #=> true
348
- #
349
- def gmt?: () -> bool
350
-
351
- # Returns the offset in seconds between the timezone of *time* and UTC.
352
- #
353
- # t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
354
- # t.gmt_offset #=> 0
355
- # l = t.getlocal #=> 2000-01-01 14:15:01 -0600
356
- # l.gmt_offset #=> -21600
357
- #
358
- def gmt_offset: () -> Integer
359
-
360
- # Converts *time* to UTC (GMT), modifying the receiver.
361
- #
362
- # t = Time.now #=> 2007-11-19 08:18:31 -0600
363
- # t.gmt? #=> false
364
- # t.gmtime #=> 2007-11-19 14:18:31 UTC
365
- # t.gmt? #=> true
366
- #
367
- # t = Time.now #=> 2007-11-19 08:18:51 -0600
368
- # t.utc? #=> false
369
- # t.utc #=> 2007-11-19 14:18:51 UTC
370
- # t.utc? #=> true
371
- #
372
- def gmtime: () -> Time
373
-
374
- # Returns a hash code for this Time object.
375
- #
376
- # See also Object#hash.
377
- #
378
- def hash: () -> Integer
379
-
380
- # Returns the hour of the day (0..23) for *time*.
381
- #
382
- # t = Time.now #=> 2007-11-19 08:26:20 -0600
383
- # t.hour #=> 8
384
- #
385
- def hour: () -> Integer
386
-
387
- # Returns a Time object.
388
- #
389
- # It is initialized to the current system time if no argument is given.
390
- #
391
- # **Note:** The new object will use the resolution available on your system
392
- # clock, and may include fractional seconds.
393
- #
394
- # If one or more arguments are specified, the time is initialized to the
395
- # specified time.
396
- #
397
- # `sec` may have fraction if it is a rational.
398
- #
399
- # `tz` specifies the timezone. It can be an offset from UTC, given either as a
400
- # string such as "+09:00" or a single letter "A".."Z" excluding "J" (so-called
401
- # military time zone), or as a number of seconds such as 32400. Or it can be a
402
- # timezone object, see [Timezone argument](#class-Time-label-Timezone+argument)
403
- # for details.
404
- #
405
- # a = Time.new #=> 2007-11-19 07:50:02 -0600
406
- # b = Time.new #=> 2007-11-19 07:50:02 -0600
407
- # a == b #=> false
408
- # "%.6f" % a.to_f #=> "1195480202.282373"
409
- # "%.6f" % b.to_f #=> "1195480202.283415"
410
- #
411
- # Time.new(2008,6,21, 13,30,0, "+09:00") #=> 2008-06-21 13:30:00 +0900
412
- #
413
- # # A trip for RubyConf 2007
414
- # t1 = Time.new(2007,11,1,15,25,0, "+09:00") # JST (Narita)
415
- # t2 = Time.new(2007,11,1,12, 5,0, "-05:00") # CDT (Minneapolis)
416
- # t3 = Time.new(2007,11,1,13,25,0, "-05:00") # CDT (Minneapolis)
417
- # t4 = Time.new(2007,11,1,16,53,0, "-04:00") # EDT (Charlotte)
418
- # t5 = Time.new(2007,11,5, 9,24,0, "-05:00") # EST (Charlotte)
419
- # t6 = Time.new(2007,11,5,11,21,0, "-05:00") # EST (Detroit)
420
- # t7 = Time.new(2007,11,5,13,45,0, "-05:00") # EST (Detroit)
421
- # t8 = Time.new(2007,11,6,17,10,0, "+09:00") # JST (Narita)
422
- # (t2-t1)/3600.0 #=> 10.666666666666666
423
- # (t4-t3)/3600.0 #=> 2.466666666666667
424
- # (t6-t5)/3600.0 #=> 1.95
425
- # (t8-t7)/3600.0 #=> 13.416666666666666
426
- #
427
- 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
428
-
429
- # Returns a detailed string representing *time*. Unlike to_s, preserves
430
- # nanoseconds in the representation for easier debugging.
431
- #
432
- # t = Time.now
433
- # t.inspect #=> "2012-11-10 18:16:12.261257655 +0100"
434
- # t.strftime "%Y-%m-%d %H:%M:%S.%N %z" #=> "2012-11-10 18:16:12.261257655 +0100"
435
- #
436
- # t.utc.inspect #=> "2012-11-10 17:16:12.261257655 UTC"
437
- # t.strftime "%Y-%m-%d %H:%M:%S.%N UTC" #=> "2012-11-10 17:16:12.261257655 UTC"
438
- #
439
- def inspect: () -> String
440
-
441
- # Returns `true` if *time* occurs during Daylight Saving Time in its time zone.
442
- #
443
- # # CST6CDT:
444
- # Time.local(2000, 1, 1).zone #=> "CST"
445
- # Time.local(2000, 1, 1).isdst #=> false
446
- # Time.local(2000, 1, 1).dst? #=> false
447
- # Time.local(2000, 7, 1).zone #=> "CDT"
448
- # Time.local(2000, 7, 1).isdst #=> true
449
- # Time.local(2000, 7, 1).dst? #=> true
450
- #
451
- # # Asia/Tokyo:
452
- # Time.local(2000, 1, 1).zone #=> "JST"
453
- # Time.local(2000, 1, 1).isdst #=> false
454
- # Time.local(2000, 1, 1).dst? #=> false
455
- # Time.local(2000, 7, 1).zone #=> "JST"
456
- # Time.local(2000, 7, 1).isdst #=> false
457
- # Time.local(2000, 7, 1).dst? #=> false
458
- #
459
- def isdst: () -> bool
460
-
461
- # Converts *time* to local time (using the local time zone in effect at the
462
- # creation time of *time*) modifying the receiver.
463
- #
464
- # If `utc_offset` is given, it is used instead of the local time.
465
- #
466
- # t = Time.utc(2000, "jan", 1, 20, 15, 1) #=> 2000-01-01 20:15:01 UTC
467
- # t.utc? #=> true
468
- #
469
- # t.localtime #=> 2000-01-01 14:15:01 -0600
470
- # t.utc? #=> false
471
- #
472
- # t.localtime("+09:00") #=> 2000-01-02 05:15:01 +0900
473
- # t.utc? #=> false
474
- #
475
- # If `utc_offset` is not given and *time* is local time, just returns the
476
- # receiver.
477
- #
478
- def localtime: (?String utc_offset) -> Time
479
-
480
- # Returns the day of the month (1..n) for *time*.
481
- #
482
- # t = Time.now #=> 2007-11-19 08:27:03 -0600
483
- # t.day #=> 19
484
- # t.mday #=> 19
485
- #
486
- def mday: () -> Integer
487
-
488
- # Returns the minute of the hour (0..59) for *time*.
489
- #
490
- # t = Time.now #=> 2007-11-19 08:25:51 -0600
491
- # t.min #=> 25
492
- #
493
- def min: () -> Integer
494
-
495
- # Returns the month of the year (1..12) for *time*.
496
- #
497
- # t = Time.now #=> 2007-11-19 08:27:30 -0600
498
- # t.mon #=> 11
499
- # t.month #=> 11
500
- #
501
- def mon: () -> Integer
502
-
503
- # Returns `true` if *time* represents Monday.
504
- #
505
- # t = Time.local(2003, 8, 4) #=> 2003-08-04 00:00:00 -0500
506
- # t.monday? #=> true
507
- #
508
- def monday?: () -> bool
509
-
510
- # Returns the number of nanoseconds for *time*.
511
- #
512
- # t = Time.now #=> 2007-11-17 15:18:03 +0900
513
- # "%10.9f" % t.to_f #=> "1195280283.536151409"
514
- # t.nsec #=> 536151406
515
- #
516
- # The lowest digits of #to_f and #nsec are different because IEEE 754 double is
517
- # not accurate enough to represent the exact number of nanoseconds since the
518
- # Epoch.
519
- #
520
- # The more accurate value is returned by #nsec.
521
- #
522
- def nsec: () -> Integer
523
-
524
- # Rounds sub seconds to a given precision in decimal digits (0 digits by
525
- # default). It returns a new Time object. `ndigits` should be zero or a positive
526
- # integer.
527
- #
528
- # require 'time'
529
- #
530
- # t = Time.utc(2010,3,30, 5,43,25.123456789r)
531
- # t.iso8601(10) #=> "2010-03-30T05:43:25.1234567890Z"
532
- # t.round.iso8601(10) #=> "2010-03-30T05:43:25.0000000000Z"
533
- # t.round(0).iso8601(10) #=> "2010-03-30T05:43:25.0000000000Z"
534
- # t.round(1).iso8601(10) #=> "2010-03-30T05:43:25.1000000000Z"
535
- # t.round(2).iso8601(10) #=> "2010-03-30T05:43:25.1200000000Z"
536
- # t.round(3).iso8601(10) #=> "2010-03-30T05:43:25.1230000000Z"
537
- # t.round(4).iso8601(10) #=> "2010-03-30T05:43:25.1235000000Z"
538
- #
539
- # t = Time.utc(1999,12,31, 23,59,59)
540
- # (t + 0.4).round.iso8601(3) #=> "1999-12-31T23:59:59.000Z"
541
- # (t + 0.49).round.iso8601(3) #=> "1999-12-31T23:59:59.000Z"
542
- # (t + 0.5).round.iso8601(3) #=> "2000-01-01T00:00:00.000Z"
543
- # (t + 1.4).round.iso8601(3) #=> "2000-01-01T00:00:00.000Z"
544
- # (t + 1.49).round.iso8601(3) #=> "2000-01-01T00:00:00.000Z"
545
- # (t + 1.5).round.iso8601(3) #=> "2000-01-01T00:00:01.000Z"
546
- #
547
- # t = Time.utc(1999,12,31, 23,59,59)
548
- # (t + 0.123456789).round(4).iso8601(6) #=> "1999-12-31T23:59:59.123500Z"
549
- #
550
- def round: (?Integer arg0) -> Time
551
-
552
- # Returns `true` if *time* represents Saturday.
553
- #
554
- # t = Time.local(2006, 6, 10) #=> 2006-06-10 00:00:00 -0500
555
- # t.saturday? #=> true
556
- #
557
- def saturday?: () -> bool
558
-
559
- # Returns the second of the minute (0..60) for *time*.
560
- #
561
- # **Note:** Seconds range from zero to 60 to allow the system to inject leap
562
- # seconds. See http://en.wikipedia.org/wiki/Leap_second for further details.
563
- #
564
- # t = Time.now #=> 2007-11-19 08:25:02 -0600
565
- # t.sec #=> 2
566
- #
567
- def sec: () -> Integer
568
-
569
- # Formats *time* according to the directives in the given format string.
570
- #
571
- # The directives begin with a percent (%) character. Any text not listed as a
572
- # directive will be passed through to the output string.
573
- #
574
- # The directive consists of a percent (%) character, zero or more flags,
575
- # optional minimum field width, optional modifier and a conversion specifier as
576
- # follows:
577
- #
578
- # %<flags><width><modifier><conversion>
579
- #
580
- # Flags:
581
- # - don't pad a numerical output
582
- # _ use spaces for padding
583
- # 0 use zeros for padding
584
- # ^ upcase the result string
585
- # # change case
586
- # : use colons for %z
587
- #
588
- # The minimum field width specifies the minimum width.
589
- #
590
- # The modifiers are "E" and "O". They are ignored.
591
- #
592
- # Format directives:
593
- #
594
- # Date (Year, Month, Day):
595
- # %Y - Year with century if provided, will pad result at least 4 digits.
596
- # -0001, 0000, 1995, 2009, 14292, etc.
597
- # %C - year / 100 (rounded down such as 20 in 2009)
598
- # %y - year % 100 (00..99)
599
- #
600
- # %m - Month of the year, zero-padded (01..12)
601
- # %_m blank-padded ( 1..12)
602
- # %-m no-padded (1..12)
603
- # %B - The full month name (``January'')
604
- # %^B uppercased (``JANUARY'')
605
- # %b - The abbreviated month name (``Jan'')
606
- # %^b uppercased (``JAN'')
607
- # %h - Equivalent to %b
608
- #
609
- # %d - Day of the month, zero-padded (01..31)
610
- # %-d no-padded (1..31)
611
- # %e - Day of the month, blank-padded ( 1..31)
612
- #
613
- # %j - Day of the year (001..366)
614
- #
615
- # Time (Hour, Minute, Second, Subsecond):
616
- # %H - Hour of the day, 24-hour clock, zero-padded (00..23)
617
- # %k - Hour of the day, 24-hour clock, blank-padded ( 0..23)
618
- # %I - Hour of the day, 12-hour clock, zero-padded (01..12)
619
- # %l - Hour of the day, 12-hour clock, blank-padded ( 1..12)
620
- # %P - Meridian indicator, lowercase (``am'' or ``pm'')
621
- # %p - Meridian indicator, uppercase (``AM'' or ``PM'')
622
- #
623
- # %M - Minute of the hour (00..59)
624
- #
625
- # %S - Second of the minute (00..60)
626
- #
627
- # %L - Millisecond of the second (000..999)
628
- # The digits under millisecond are truncated to not produce 1000.
629
- # %N - Fractional seconds digits, default is 9 digits (nanosecond)
630
- # %3N millisecond (3 digits)
631
- # %6N microsecond (6 digits)
632
- # %9N nanosecond (9 digits)
633
- # %12N picosecond (12 digits)
634
- # %15N femtosecond (15 digits)
635
- # %18N attosecond (18 digits)
636
- # %21N zeptosecond (21 digits)
637
- # %24N yoctosecond (24 digits)
638
- # The digits under the specified length are truncated to avoid
639
- # carry up.
640
- #
641
- # Time zone:
642
- # %z - Time zone as hour and minute offset from UTC (e.g. +0900)
643
- # %:z - hour and minute offset from UTC with a colon (e.g. +09:00)
644
- # %::z - hour, minute and second offset from UTC (e.g. +09:00:00)
645
- # %Z - Abbreviated time zone name or similar information. (OS dependent)
646
- #
647
- # Weekday:
648
- # %A - The full weekday name (``Sunday'')
649
- # %^A uppercased (``SUNDAY'')
650
- # %a - The abbreviated name (``Sun'')
651
- # %^a uppercased (``SUN'')
652
- # %u - Day of the week (Monday is 1, 1..7)
653
- # %w - Day of the week (Sunday is 0, 0..6)
654
- #
655
- # ISO 8601 week-based year and week number:
656
- # The first week of YYYY starts with a Monday and includes YYYY-01-04.
657
- # The days in the year before the first week are in the last week of
658
- # the previous year.
659
- # %G - The week-based year
660
- # %g - The last 2 digits of the week-based year (00..99)
661
- # %V - Week number of the week-based year (01..53)
662
- #
663
- # Week number:
664
- # The first week of YYYY that starts with a Sunday or Monday (according to %U
665
- # or %W). The days in the year before the first week are in week 0.
666
- # %U - Week number of the year. The week starts with Sunday. (00..53)
667
- # %W - Week number of the year. The week starts with Monday. (00..53)
668
- #
669
- # Seconds since the Epoch:
670
- # %s - Number of seconds since 1970-01-01 00:00:00 UTC.
671
- #
672
- # Literal string:
673
- # %n - Newline character (\n)
674
- # %t - Tab character (\t)
675
- # %% - Literal ``%'' character
676
- #
677
- # Combination:
678
- # %c - date and time (%a %b %e %T %Y)
679
- # %D - Date (%m/%d/%y)
680
- # %F - The ISO 8601 date format (%Y-%m-%d)
681
- # %v - VMS date (%e-%^b-%4Y)
682
- # %x - Same as %D
683
- # %X - Same as %T
684
- # %r - 12-hour time (%I:%M:%S %p)
685
- # %R - 24-hour time (%H:%M)
686
- # %T - 24-hour time (%H:%M:%S)
687
- #
688
- # This method is similar to strftime() function defined in ISO C and POSIX.
689
- #
690
- # While all directives are locale independent since Ruby 1.9, %Z is platform
691
- # dependent. So, the result may differ even if the same format string is used in
692
- # other systems such as C.
693
- #
694
- # %z is recommended over %Z. %Z doesn't identify the timezone. For example,
695
- # "CST" is used at America/Chicago (-06:00), America/Havana (-05:00),
696
- # Asia/Harbin (+08:00), Australia/Darwin (+09:30) and Australia/Adelaide
697
- # (+10:30). Also, %Z is highly dependent on the operating system. For example,
698
- # it may generate a non ASCII string on Japanese Windows, i.e. the result can be
699
- # different to "JST". So the numeric time zone offset, %z, is recommended.
700
- #
701
- # Examples:
702
- #
703
- # t = Time.new(2007,11,19,8,37,48,"-06:00") #=> 2007-11-19 08:37:48 -0600
704
- # t.strftime("Printed on %m/%d/%Y") #=> "Printed on 11/19/2007"
705
- # t.strftime("at %I:%M %p") #=> "at 08:37 AM"
706
- #
707
- # Various ISO 8601 formats:
708
- # %Y%m%d => 20071119 Calendar date (basic)
709
- # %F => 2007-11-19 Calendar date (extended)
710
- # %Y-%m => 2007-11 Calendar date, reduced accuracy, specific month
711
- # %Y => 2007 Calendar date, reduced accuracy, specific year
712
- # %C => 20 Calendar date, reduced accuracy, specific century
713
- # %Y%j => 2007323 Ordinal date (basic)
714
- # %Y-%j => 2007-323 Ordinal date (extended)
715
- # %GW%V%u => 2007W471 Week date (basic)
716
- # %G-W%V-%u => 2007-W47-1 Week date (extended)
717
- # %GW%V => 2007W47 Week date, reduced accuracy, specific week (basic)
718
- # %G-W%V => 2007-W47 Week date, reduced accuracy, specific week (extended)
719
- # %H%M%S => 083748 Local time (basic)
720
- # %T => 08:37:48 Local time (extended)
721
- # %H%M => 0837 Local time, reduced accuracy, specific minute (basic)
722
- # %H:%M => 08:37 Local time, reduced accuracy, specific minute (extended)
723
- # %H => 08 Local time, reduced accuracy, specific hour
724
- # %H%M%S,%L => 083748,000 Local time with decimal fraction, comma as decimal sign (basic)
725
- # %T,%L => 08:37:48,000 Local time with decimal fraction, comma as decimal sign (extended)
726
- # %H%M%S.%L => 083748.000 Local time with decimal fraction, full stop as decimal sign (basic)
727
- # %T.%L => 08:37:48.000 Local time with decimal fraction, full stop as decimal sign (extended)
728
- # %H%M%S%z => 083748-0600 Local time and the difference from UTC (basic)
729
- # %T%:z => 08:37:48-06:00 Local time and the difference from UTC (extended)
730
- # %Y%m%dT%H%M%S%z => 20071119T083748-0600 Date and time of day for calendar date (basic)
731
- # %FT%T%:z => 2007-11-19T08:37:48-06:00 Date and time of day for calendar date (extended)
732
- # %Y%jT%H%M%S%z => 2007323T083748-0600 Date and time of day for ordinal date (basic)
733
- # %Y-%jT%T%:z => 2007-323T08:37:48-06:00 Date and time of day for ordinal date (extended)
734
- # %GW%V%uT%H%M%S%z => 2007W471T083748-0600 Date and time of day for week date (basic)
735
- # %G-W%V-%uT%T%:z => 2007-W47-1T08:37:48-06:00 Date and time of day for week date (extended)
736
- # %Y%m%dT%H%M => 20071119T0837 Calendar date and local time (basic)
737
- # %FT%R => 2007-11-19T08:37 Calendar date and local time (extended)
738
- # %Y%jT%H%MZ => 2007323T0837Z Ordinal date and UTC of day (basic)
739
- # %Y-%jT%RZ => 2007-323T08:37Z Ordinal date and UTC of day (extended)
740
- # %GW%V%uT%H%M%z => 2007W471T0837-0600 Week date and local time and difference from UTC (basic)
741
- # %G-W%V-%uT%R%:z => 2007-W47-1T08:37-06:00 Week date and local time and difference from UTC (extended)
742
- #
743
- def strftime: (String arg0) -> String
744
-
745
- # Returns the fraction for *time*.
746
- #
747
- # The return value can be a rational number.
748
- #
749
- # t = Time.now #=> 2009-03-26 22:33:12 +0900
750
- # "%10.9f" % t.to_f #=> "1238074392.940563917"
751
- # t.subsec #=> (94056401/100000000)
752
- #
753
- # The lowest digits of #to_f and #subsec are different because IEEE 754 double
754
- # is not accurate enough to represent the rational number.
755
- #
756
- # The more accurate value is returned by #subsec.
757
- #
758
- def subsec: () -> Numeric
759
-
760
- # Returns a new Time object, one second later than *time*. Time#succ is obsolete
761
- # since 1.9.2 for time is not a discrete value.
762
- #
763
- # t = Time.now #=> 2007-11-19 08:23:57 -0600
764
- # t.succ #=> 2007-11-19 08:23:58 -0600
765
- #
766
- # Use instead `time + 1`
767
- #
768
- # t + 1 #=> 2007-11-19 08:23:58 -0600
769
- #
770
- def succ: () -> Time
771
-
772
- # Returns `true` if *time* represents Sunday.
773
- #
774
- # t = Time.local(1990, 4, 1) #=> 1990-04-01 00:00:00 -0600
775
- # t.sunday? #=> true
776
- #
777
- def sunday?: () -> bool
778
-
779
- # Returns `true` if *time* represents Thursday.
780
- #
781
- # t = Time.local(1995, 12, 21) #=> 1995-12-21 00:00:00 -0600
782
- # t.thursday? #=> true
783
- #
784
- def thursday?: () -> bool
785
-
786
- # Returns a ten-element *array* of values for *time*:
787
- #
788
- # [sec, min, hour, day, month, year, wday, yday, isdst, zone]
789
- #
790
- # See the individual methods for an explanation of the valid ranges of each
791
- # value. The ten elements can be passed directly to Time::utc or Time::local to
792
- # create a new Time object.
793
- #
794
- # t = Time.now #=> 2007-11-19 08:36:01 -0600
795
- # now = t.to_a #=> [1, 36, 8, 19, 11, 2007, 1, 323, false, "CST"]
796
- #
797
- def to_a: () -> [ Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, bool, String ]
798
-
799
- # Returns the value of *time* as a floating point number of seconds since the
800
- # Epoch.
801
- #
802
- # t = Time.now
803
- # "%10.5f" % t.to_f #=> "1270968744.77658"
804
- # t.to_i #=> 1270968744
805
- #
806
- # Note that IEEE 754 double is not accurate enough to represent the exact number
807
- # of nanoseconds since the Epoch.
808
- #
809
- def to_f: () -> Float
810
-
811
- # Returns the value of *time* as an integer number of seconds since the Epoch.
812
- #
813
- # t = Time.now
814
- # "%10.5f" % t.to_f #=> "1270968656.89607"
815
- # t.to_i #=> 1270968656
816
- #
817
- def to_i: () -> Integer
818
-
819
- # Returns the value of *time* as a rational number of seconds since the Epoch.
820
- #
821
- # t = Time.now
822
- # t.to_r #=> (1270968792716287611/1000000000)
823
- #
824
- # This methods is intended to be used to get an accurate value representing the
825
- # nanoseconds since the Epoch. You can use this method to convert *time* to
826
- # another Epoch.
827
- #
828
- def to_r: () -> Rational
829
-
830
- # Returns a string representing *time*. Equivalent to calling #strftime with the
831
- # appropriate format string.
832
- #
833
- # t = Time.now
834
- # t.to_s #=> "2012-11-10 18:16:12 +0100"
835
- # t.strftime "%Y-%m-%d %H:%M:%S %z" #=> "2012-11-10 18:16:12 +0100"
836
- #
837
- # t.utc.to_s #=> "2012-11-10 17:16:12 UTC"
838
- # t.strftime "%Y-%m-%d %H:%M:%S UTC" #=> "2012-11-10 17:16:12 UTC"
839
- #
840
- def to_s: () -> String
841
-
842
- # Returns `true` if *time* represents Tuesday.
843
- #
844
- # t = Time.local(1991, 2, 19) #=> 1991-02-19 00:00:00 -0600
845
- # t.tuesday? #=> true
846
- #
847
- def tuesday?: () -> bool
848
-
849
- # Returns the number of nanoseconds for *time*.
850
- #
851
- # t = Time.now #=> 2007-11-17 15:18:03 +0900
852
- # "%10.9f" % t.to_f #=> "1195280283.536151409"
853
- # t.nsec #=> 536151406
854
- #
855
- # The lowest digits of #to_f and #nsec are different because IEEE 754 double is
856
- # not accurate enough to represent the exact number of nanoseconds since the
857
- # Epoch.
858
- #
859
- # The more accurate value is returned by #nsec.
860
- #
861
- def tv_nsec: () -> Numeric
862
-
863
- # Returns the value of *time* as an integer number of seconds since the Epoch.
864
- #
865
- # t = Time.now
866
- # "%10.5f" % t.to_f #=> "1270968656.89607"
867
- # t.to_i #=> 1270968656
868
- #
869
- def tv_sec: () -> Numeric
870
-
871
- # Returns the number of microseconds for *time*.
872
- #
873
- # t = Time.now #=> 2007-11-19 08:03:26 -0600
874
- # "%10.6f" % t.to_f #=> "1195481006.775195"
875
- # t.usec #=> 775195
876
- #
877
- def tv_usec: () -> Numeric
878
-
879
- # Returns the number of microseconds for *time*.
880
- #
881
- # t = Time.now #=> 2007-11-19 08:03:26 -0600
882
- # "%10.6f" % t.to_f #=> "1195481006.775195"
883
- # t.usec #=> 775195
884
- #
885
- def usec: () -> Numeric
886
-
887
- # Converts *time* to UTC (GMT), modifying the receiver.
888
- #
889
- # t = Time.now #=> 2007-11-19 08:18:31 -0600
890
- # t.gmt? #=> false
891
- # t.gmtime #=> 2007-11-19 14:18:31 UTC
892
- # t.gmt? #=> true
893
- #
894
- # t = Time.now #=> 2007-11-19 08:18:51 -0600
895
- # t.utc? #=> false
896
- # t.utc #=> 2007-11-19 14:18:51 UTC
897
- # t.utc? #=> true
898
- #
899
- def utc: () -> Time
900
-
901
- # Returns `true` if *time* represents a time in UTC (GMT).
902
- #
903
- # t = Time.now #=> 2007-11-19 08:15:23 -0600
904
- # t.utc? #=> false
905
- # t = Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
906
- # t.utc? #=> true
907
- #
908
- # t = Time.now #=> 2007-11-19 08:16:03 -0600
909
- # t.gmt? #=> false
910
- # t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
911
- # t.gmt? #=> true
912
- #
913
- def utc?: () -> bool
914
-
915
- # Returns the offset in seconds between the timezone of *time* and UTC.
916
- #
917
- # t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
918
- # t.gmt_offset #=> 0
919
- # l = t.getlocal #=> 2000-01-01 14:15:01 -0600
920
- # l.gmt_offset #=> -21600
921
- #
922
- def utc_offset: () -> Integer
923
-
924
- # Returns an integer representing the day of the week, 0..6, with Sunday == 0.
925
- #
926
- # t = Time.now #=> 2007-11-20 02:35:35 -0600
927
- # t.wday #=> 2
928
- # t.sunday? #=> false
929
- # t.monday? #=> false
930
- # t.tuesday? #=> true
931
- # t.wednesday? #=> false
932
- # t.thursday? #=> false
933
- # t.friday? #=> false
934
- # t.saturday? #=> false
935
- #
936
- def wday: () -> Integer
937
-
938
- # Returns `true` if *time* represents Wednesday.
939
- #
940
- # t = Time.local(1993, 2, 24) #=> 1993-02-24 00:00:00 -0600
941
- # t.wednesday? #=> true
942
- #
943
- def wednesday?: () -> bool
944
-
945
- # Returns an integer representing the day of the year, 1..366.
946
- #
947
- # t = Time.now #=> 2007-11-19 08:32:31 -0600
948
- # t.yday #=> 323
949
- #
950
- def yday: () -> Integer
951
-
952
- # Returns the year for *time* (including the century).
953
- #
954
- # t = Time.now #=> 2007-11-19 08:27:51 -0600
955
- # t.year #=> 2007
956
- #
957
- def year: () -> Integer
958
-
959
- # Returns the name of the time zone used for *time*. As of Ruby 1.8, returns
960
- # ``UTC'' rather than ``GMT'' for UTC times.
961
- #
962
- # t = Time.gm(2000, "jan", 1, 20, 15, 1)
963
- # t.zone #=> "UTC"
964
- # t = Time.local(2000, "jan", 1, 20, 15, 1)
965
- # t.zone #=> "CST"
966
- #
967
- def zone: () -> String
968
-
969
- # Same as Time::gm, but interprets the values in the local time zone.
970
- #
971
- # Time.local(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 -0600
972
- #
973
- def self.mktime: (Integer year, ?Integer | String month, ?Integer day, ?Integer hour, ?Integer min, ?Numeric sec, ?Numeric usec_with_frac) -> Time
974
-
975
- # Returns the offset in seconds between the timezone of *time* and UTC.
976
- #
977
- # t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
978
- # t.gmt_offset #=> 0
979
- # l = t.getlocal #=> 2000-01-01 14:15:01 -0600
980
- # l.gmt_offset #=> -21600
981
- #
982
- def gmtoff: () -> Integer
983
-
984
- # Returns the month of the year (1..12) for *time*.
985
- #
986
- # t = Time.now #=> 2007-11-19 08:27:30 -0600
987
- # t.mon #=> 11
988
- # t.month #=> 11
989
- #
990
- def month: () -> Integer
991
-
992
- # Floors sub seconds to a given precision in decimal digits (0 digits by
993
- # default). It returns a new Time object. `ndigits` should be zero or a positive
994
- # integer.
995
- #
996
- # require 'time'
997
- #
998
- # t = Time.utc(2010,3,30, 5,43,25.123456789r)
999
- # t.iso8601(10) #=> "2010-03-30T05:43:25.1234567890Z"
1000
- # t.floor.iso8601(10) #=> "2010-03-30T05:43:25.0000000000Z"
1001
- # t.floor(0).iso8601(10) #=> "2010-03-30T05:43:25.0000000000Z"
1002
- # t.floor(1).iso8601(10) #=> "2010-03-30T05:43:25.1000000000Z"
1003
- # t.floor(2).iso8601(10) #=> "2010-03-30T05:43:25.1200000000Z"
1004
- # t.floor(3).iso8601(10) #=> "2010-03-30T05:43:25.1230000000Z"
1005
- # t.floor(4).iso8601(10) #=> "2010-03-30T05:43:25.1234000000Z"
1006
- #
1007
- # t = Time.utc(1999,12,31, 23,59,59)
1008
- # (t + 0.4).floor.iso8601(3) #=> "1999-12-31T23:59:59.000Z"
1009
- # (t + 0.9).floor.iso8601(3) #=> "1999-12-31T23:59:59.000Z"
1010
- # (t + 1.4).floor.iso8601(3) #=> "2000-01-01T00:00:00.000Z"
1011
- # (t + 1.9).floor.iso8601(3) #=> "2000-01-01T00:00:00.000Z"
1012
- #
1013
- # t = Time.utc(1999,12,31, 23,59,59)
1014
- # (t + 0.123456789).floor(4).iso8601(6) #=> "1999-12-31T23:59:59.123400Z"
1015
- #
1016
- def floor: (?Integer ndigits) -> Time
1017
-
1018
- # Ceils sub seconds to a given precision in decimal digits (0 digits by
1019
- # default). It returns a new Time object. `ndigits` should be zero or a positive
1020
- # integer.
1021
- #
1022
- # require 'time'
1023
- #
1024
- # t = Time.utc(2010,3,30, 5,43,25.0123456789r)
1025
- # t.iso8601(10) #=> "2010-03-30T05:43:25.0123456789Z"
1026
- # t.ceil.iso8601(10) #=> "2010-03-30T05:43:26.0000000000Z"
1027
- # t.ceil(0).iso8601(10) #=> "2010-03-30T05:43:26.0000000000Z"
1028
- # t.ceil(1).iso8601(10) #=> "2010-03-30T05:43:25.1000000000Z"
1029
- # t.ceil(2).iso8601(10) #=> "2010-03-30T05:43:25.0200000000Z"
1030
- # t.ceil(3).iso8601(10) #=> "2010-03-30T05:43:25.0130000000Z"
1031
- # t.ceil(4).iso8601(10) #=> "2010-03-30T05:43:25.0124000000Z"
1032
- #
1033
- # t = Time.utc(1999,12,31, 23,59,59)
1034
- # (t + 0.4).ceil.iso8601(3) #=> "2000-01-01T00:00:00.000Z"
1035
- # (t + 0.9).ceil.iso8601(3) #=> "2000-01-01T00:00:00.000Z"
1036
- # (t + 1.4).ceil.iso8601(3) #=> "2000-01-01T00:00:01.000Z"
1037
- # (t + 1.9).ceil.iso8601(3) #=> "2000-01-01T00:00:01.000Z"
1038
- #
1039
- # t = Time.utc(1999,12,31, 23,59,59)
1040
- # (t + 0.123456789).ceil(4).iso8601(6) #=> "1999-12-31T23:59:59.123500Z"
1041
- #
1042
- def ceil: (?Integer ndigits) -> Time
1043
- end
1044
-
1045
- Time::RFC2822_DAY_NAME: Array[String]
1046
-
1047
- Time::RFC2822_MONTH_NAME: Array[String]