Skip to content

Commit

Permalink
[DOC] Include timezones document in timev.rb
Browse files Browse the repository at this point in the history
So that it can be referred as a part of the document of `Time`.
  • Loading branch information
nobu committed Dec 2, 2023
1 parent c9c1670 commit ae3e9f1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 5 additions & 7 deletions doc/timezones.rdoc → doc/_timezones.rdoc
@@ -1,5 +1,3 @@
= Timezones

== Timezone Specifiers

Certain \Time methods accept arguments that specify timezones:
Expand All @@ -13,11 +11,11 @@ Certain \Time methods accept arguments that specify timezones:
The value given with any of these must be one of the following
(each detailed below):

- {Hours/minutes offset}[rdoc-ref:timezones.rdoc@Hours-2FMinutes+Offsets].
- {Single-letter offset}[rdoc-ref:timezones.rdoc@Single-Letter+Offsets].
- {Integer offset}[rdoc-ref:timezones.rdoc@Integer+Offsets].
- {Timezone object}[rdoc-ref:timezones.rdoc@Timezone+Objects].
- {Timezone name}[rdoc-ref:timezones.rdoc@Timezone+Names].
- {Hours/minutes offset}[rdoc-ref:Time@Hours-2FMinutes+Offsets].
- {Single-letter offset}[rdoc-ref:Time@Single-Letter+Offsets].
- {Integer offset}[rdoc-ref:Time@Integer+Offsets].
- {Timezone object}[rdoc-ref:Time@Timezone+Objects].
- {Timezone name}[rdoc-ref:Time@Timezone+Names].

=== Hours/Minutes Offsets

Expand Down
4 changes: 2 additions & 2 deletions time.c
Expand Up @@ -4075,7 +4075,7 @@ time_zonelocal(VALUE time, VALUE off)
* t.localtime("-09:00") # => 2000-01-01 11:15:01 -0900
*
* For forms of argument +zone+, see
* {Timezone Specifiers}[rdoc-ref:timezones.rdoc].
* {Timezone Specifiers}[rdoc-ref:Time@Timezone+Specifiers].
*
*/

Expand Down Expand Up @@ -4176,7 +4176,7 @@ time_fixoff(VALUE time)
* t.getlocal('+12:00') # => 2000-01-01 12:00:00 +1200
*
* For forms of argument +zone+, see
* {Timezone Specifiers}[rdoc-ref:timezones.rdoc].
* {Timezone Specifiers}[rdoc-ref:Time@Timezone+Specifiers].
*
*/

Expand Down
12 changes: 7 additions & 5 deletions timev.rb
Expand Up @@ -66,7 +66,7 @@
#
# Time.new(2002, 10, 31, 2, 2, 2, "+02:00") #=> 2002-10-31 02:02:02 +0200
#
# Or {a timezone object}[rdoc-ref:timezones.rdoc@Timezone+Objects]:
# Or {a timezone object}[rdoc-ref:Time@Timezone+Objects]:
#
# zone = timezone("Europe/Athens") # Eastern European Time, UTC+2
# Time.new(2002, 10, 31, 2, 2, 2, zone) #=> 2002-10-31 02:02:02 +0200
Expand Down Expand Up @@ -210,7 +210,9 @@
# - #floor: Returns a new time with subseconds lowered to a floor.
#
# For the forms of argument +zone+, see
# {Timezone Specifiers}[rdoc-ref:timezones.rdoc].
# {Timezone Specifiers}[rdoc-ref:Time@Timezone+Specifiers].
#
# :include: doc/_timezones.rdoc
class Time
# Creates a new \Time object from the current system time.
# This is the same as Time.new without arguments.
Expand All @@ -219,7 +221,7 @@ class Time
# Time.now(in: '+04:00') # => 2009-06-24 07:39:54 +0400
#
# For forms of argument +zone+, see
# {Timezone Specifiers}[rdoc-ref:timezones.rdoc].
# {Timezone Specifiers}[rdoc-ref:Time@Timezone+Specifiers].
def self.now(in: nil)
Primitive.time_s_now(Primitive.arg!(:in))
end
Expand Down Expand Up @@ -277,7 +279,7 @@ def self.now(in: nil)
# Time.at(secs, in: '-12:00') # => 2000-12-31 17:59:59 -1200
#
# For the forms of argument +zone+, see
# {Timezone Specifiers}[rdoc-ref:timezones.rdoc].
# {Timezone Specifiers}[rdoc-ref:Time@Timezone+Specifiers].
#
def self.at(time, subsec = false, unit = :microsecond, in: nil)
if Primitive.mandatory_only?
Expand Down Expand Up @@ -371,7 +373,7 @@ def self.at(time, subsec = false, unit = :microsecond, in: nil)
# When positional argument +zone+ or keyword argument +in:+ is given,
# the new \Time object is in the specified timezone.
# For the forms of argument +zone+, see
# {Timezone Specifiers}[rdoc-ref:timezones.rdoc]:
# {Timezone Specifiers}[rdoc-ref:Time@Timezone+Specifiers]:
#
# Time.new(2000, 1, 1, 0, 0, 0, '+12:00')
# # => 2000-01-01 00:00:00 +1200
Expand Down

0 comments on commit ae3e9f1

Please sign in to comment.