diff options
author | Burdette Lamar <BurdetteLamar@Yahoo.com> | 2022-08-31 16:36:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-31 16:36:22 -0500 |
commit | d41be1ac37a91f901a0030bfd10979240621db4e (patch) | |
tree | 8e3df33b75f24a977a25d874e720f31be4a2a4c5 /timev.rb | |
parent | 036bb55980e70e41d9017b177de77c26cf57a3f3 (diff) |
[DOC] Enhanced RDoc for Time (#6308)
More on timezones.
Notes
Notes:
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
Diffstat (limited to 'timev.rb')
-rw-r--r-- | timev.rb | 40 |
1 files changed, 5 insertions, 35 deletions
@@ -208,38 +208,8 @@ # - #ceil: Returns a new time with subseconds raised to a ceiling. # - #floor: Returns a new time with subseconds lowered to a floor. # -# == Timezone Argument -# -# A timezone argument must have +local_to_utc+ and +utc_to_local+ -# methods, and may have +name+, +abbr+, and +dst?+ methods. -# -# The +local_to_utc+ method should convert a Time-like object from -# the timezone to UTC, and +utc_to_local+ is the opposite. The -# result also should be a Time or Time-like object (not necessary to -# be the same class). The #zone of the result is just ignored. -# Time-like argument to these methods is similar to a Time object in -# UTC without subsecond; it has attribute readers for the parts, -# e.g. #year, #month, and so on, and epoch time readers, #to_i. The -# subsecond attributes are fixed as 0, and #utc_offset, #zone, -# #isdst, and their aliases are same as a Time object in UTC. -# Also #to_time, #+, and #- methods are defined. -# -# The +name+ method is used for marshaling. If this method is not -# defined on a timezone object, Time objects using that timezone -# object can not be dumped by Marshal. -# -# The +abbr+ method is used by '%Z' in #strftime. -# -# The +dst?+ method is called with a +Time+ value and should return whether -# the +Time+ value is in daylight savings time in the zone. -# -# === Auto Conversion to Timezone -# -# At loading marshaled data, a timezone name will be converted to a timezone -# object by +find_timezone+ class method, if the method is defined. -# -# Similarly, that class method will be called when a timezone argument does -# not have the necessary methods mentioned above. +# For the forms of argument +zone+, see +# {Timezone Specifiers}[rdoc-ref:timezones.rdoc]. class Time # Creates a new \Time object from the current system time. # This is the same as Time.new without arguments. @@ -248,7 +218,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:timezone_specifiers.rdoc]. + # {Timezone Specifiers}[rdoc-ref:timezones.rdoc]. def self.now(in: nil) Primitive.time_s_now(Primitive.arg!(:in)) end @@ -306,7 +276,7 @@ class Time # Time.at(secs, in: '-12:00') # => 2000-12-31 17:59:59 -1200 # # For the forms of argument +zone+, see - # {Timezone Specifiers}[rdoc-ref:timezone_specifiers.rdoc]. + # {Timezone Specifiers}[rdoc-ref:timezones.rdoc]. # def self.at(time, subsec = false, unit = :microsecond, in: nil) if Primitive.mandatory_only? @@ -383,7 +353,7 @@ class Time # 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:timezone_specifiers.rdoc]: + # {Timezone Specifiers}[rdoc-ref:timezones.rdoc]: # # Time.new(2000, 1, 1, 0, 0, 0, '+12:00') # # => 2000-01-01 00:00:00 +1200 |