Skip to content

Commit

Permalink
Merge pull request #2482 from osyo-manga/add-doc-time_ceil_floor
Browse files Browse the repository at this point in the history
Time#ceil Time#floor の日本語ドキュメントを追加
  • Loading branch information
znz authored Mar 23, 2021
2 parents 9770871 + e10893c commit b77ca7e
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions refm/api/src/_builtin/Time
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,13 @@ p Time.local(2000).ctime # => "Sat Jan 1 00:00:00 2000"
#@since 2.7.0
--- ceil(ndigits=0) -> Time

Ceils sub seconds to a given precision in decimal digits (0 digits by
default). It returns a new Time object. `ndigits` should be zero or a
positive integer.
十進小数点数で指定した桁数の精度で切り上げをし、
その [[c:Time]] オブジェクトを返します。
(デフォルトは0、つまり小数点の所で切り上げます)。

ndigits には 0 以上の整数を渡します。

@param ndigits 十進での精度(桁数)

#@samplecode
require 'time'
Expand All @@ -445,6 +449,8 @@ t = Time.utc(1999,12,31, 23,59,59)
t = Time.utc(1999,12,31, 23,59,59)
(t + 0.123456789).ceil(4).iso8601(6) # => "1999-12-31T23:59:59.123500Z"
#@end

@see [[m:Time#floor]], [[m:Time#round]]
#@end

--- gmt? -> bool
Expand Down Expand Up @@ -920,9 +926,13 @@ p t.usec #=> 6
#@since 2.7.0
--- floor(ndigits=0) -> Time

Floors sub seconds to a given precision in decimal digits (0 digits by
default). It returns a new Time object. `ndigits` should be zero or a
positive integer.
十進小数点数で指定した桁数の精度で切り捨てをし、
その [[c:Time]] オブジェクトを返します。
(デフォルトは0、つまり小数点の所で切り捨てます)。

ndigits には 0 以上の整数を渡します。

@param ndigits 十進での精度(桁数)

#@samplecode
require 'time'
Expand All @@ -945,6 +955,8 @@ t = Time.utc(1999,12,31, 23,59,59)
t = Time.utc(1999,12,31, 23,59,59)
(t + 0.123456789).floor(4).iso8601(6) # => "1999-12-31T23:59:59.123400Z"
#@end

@see [[m:Time#ceil]], [[m:Time#round]]
#@end

--- friday? -> bool
Expand Down Expand Up @@ -1056,6 +1068,10 @@ t = Time.utc(1999,12,31, 23,59,59)
p (t + 0.123456789).round(4).iso8601(6) # => "1999-12-31T23:59:59.123500Z"
#@end

#@since 2.7.0
@see [[m:Time#ceil]], [[m:Time#floor]]
#@end

--- subsec -> Integer | Rational

時刻を表す分数を返します。
Expand Down

0 comments on commit b77ca7e

Please sign in to comment.