Improve documentation of ActiveSupport::TimeZone.create [ci-skip]
The `create` method is currently marked as an alias of `new`. However, because `new` is later overridden, it's no longer an alias. This requires wrapping the `alias_method` with stopdoc/startdoc, as the method is still marked as an alias otherwise (adding `:nodoc:` doesn't help). The `initialize` method has to be wrapped with stopdoc/startdoc as well, as the `new` method will still be documented for the initialized. Adding a `:nodoc:` instead will remove documentation for all following methods.
This commit is contained in:
parent
1007cc8c03
commit
15b45953a0
@ -208,7 +208,9 @@ def find_tzinfo(name)
|
||||
TZInfo::Timezone.get(MAPPING[name] || name)
|
||||
end
|
||||
|
||||
# :stopdoc:
|
||||
alias_method :create, :new
|
||||
# :startdoc:
|
||||
|
||||
# Returns a TimeZone instance with the given name, or +nil+ if no
|
||||
# such TimeZone instance exists. (This exists to support the use of
|
||||
@ -296,15 +298,22 @@ def zones_map
|
||||
attr_reader :name
|
||||
attr_reader :tzinfo
|
||||
|
||||
##
|
||||
# :singleton-method: create
|
||||
# :call-seq: create(name, utc_offset = nil, tzinfo = nil)
|
||||
#
|
||||
# Create a new TimeZone object with the given name and offset. The
|
||||
# offset is the number of seconds that this time zone is offset from UTC
|
||||
# (GMT). Seconds were chosen as the offset unit because that is the unit
|
||||
# that Ruby uses to represent time zone offsets (see Time#utc_offset).
|
||||
|
||||
# :stopdoc:
|
||||
def initialize(name, utc_offset = nil, tzinfo = nil)
|
||||
@name = name
|
||||
@utc_offset = utc_offset
|
||||
@tzinfo = tzinfo || TimeZone.find_tzinfo(name)
|
||||
end
|
||||
# :startdoc:
|
||||
|
||||
# Returns the offset of this time zone from UTC in seconds.
|
||||
def utc_offset
|
||||
|
Loading…
Reference in New Issue
Block a user