Skip to content

Commit efa8889

Browse files
authored
Merge pull request rails#51017 from p8/activesupport/document-time-zone-create
Improve documentation of ActiveSupport::TimeZone.create [ci-skip]
2 parents fbb230e + 15b4595 commit efa8889

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

activesupport/lib/active_support/values/time_zone.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ def find_tzinfo(name)
208208
TZInfo::Timezone.get(MAPPING[name] || name)
209209
end
210210

211+
# :stopdoc:
211212
alias_method :create, :new
213+
# :startdoc:
212214

213215
# Returns a TimeZone instance with the given name, or +nil+ if no
214216
# such TimeZone instance exists. (This exists to support the use of
@@ -296,15 +298,22 @@ def zones_map
296298
attr_reader :name
297299
attr_reader :tzinfo
298300

301+
##
302+
# :singleton-method: create
303+
# :call-seq: create(name, utc_offset = nil, tzinfo = nil)
304+
#
299305
# Create a new TimeZone object with the given name and offset. The
300306
# offset is the number of seconds that this time zone is offset from UTC
301307
# (GMT). Seconds were chosen as the offset unit because that is the unit
302308
# that Ruby uses to represent time zone offsets (see Time#utc_offset).
309+
310+
# :stopdoc:
303311
def initialize(name, utc_offset = nil, tzinfo = nil)
304312
@name = name
305313
@utc_offset = utc_offset
306314
@tzinfo = tzinfo || TimeZone.find_tzinfo(name)
307315
end
316+
# :startdoc:
308317

309318
# Returns the offset of this time zone from UTC in seconds.
310319
def utc_offset

0 commit comments

Comments
 (0)