@@ -544,7 +544,7 @@ def initialize(*options)
544544 @scalar = date . ajd
545545 @numerator = [ "<day>" ]
546546 @denominator = UNITY_ARRAY
547- in /^\s *$/ => empty
547+ in /^\s *$/ => _empty
548548 raise ArgumentError , "No Unit Specified"
549549 in String => str
550550 parse ( str )
@@ -1341,13 +1341,18 @@ def abs
13411341 end
13421342
13431343 # ceil of a unit
1344+ # Forwards all arguments to the scalar's ceil method
1345+ # @param args [Array] arguments to pass to the scalar's ceil method (e.g., number of decimal digits)
13441346 # @return [Numeric,Unit]
13451347 def ceil ( ...)
13461348 return @scalar . ceil ( ...) if unitless?
13471349
13481350 self . class . new ( scalar : @scalar . ceil ( ...) , numerator : @numerator , denominator : @denominator )
13491351 end
13501352
1353+ # Floor of a unit
1354+ # Forwards all arguments to the scalar's floor method
1355+ # @param args [Array] arguments to pass to the scalar's floor method (e.g., number of decimal digits)
13511356 # @return [Numeric,Unit]
13521357 def floor ( ...)
13531358 return @scalar . floor ( ...) if unitless?
@@ -1360,17 +1365,22 @@ def floor(...)
13601365 # Rational, etc..). Because unit conversions can often result in Rational
13611366 # scalars (to preserve precision), it may be advisable to use +to_s+ to
13621367 # format output instead of using +round+.
1368+ # Forwards all arguments to the scalar's round method
13631369 # @example
13641370 # RubyUnits::Unit.new('21870 mm/min').convert_to('m/min').round(1) #=> 2187/100 m/min
13651371 # RubyUnits::Unit.new('21870 mm/min').convert_to('m/min').to_s('%0.1f') #=> 21.9 m/min
13661372 #
1373+ # @param args [Array] arguments to pass to the scalar's round method (e.g., number of decimal digits, mode)
13671374 # @return [Numeric,Unit]
13681375 def round ( ...)
13691376 return @scalar . round ( ...) if unitless?
13701377
13711378 self . class . new ( scalar : @scalar . round ( ...) , numerator : @numerator , denominator : @denominator )
13721379 end
13731380
1381+ # Truncate the unit according to the scalar's truncate method
1382+ # Forwards all arguments to the scalar's truncate method
1383+ # @param args [Array] arguments to pass to the scalar's truncate method (e.g., number of decimal digits)
13741384 # @return [Numeric, Unit]
13751385 def truncate ( ...)
13761386 return @scalar . truncate ( ...) if unitless?
0 commit comments