Class Lisp::Format::Directives::FFFP
In: lib/facet/lisp-format.rb
Parent: Directive

Represents the ~F (Fixed-format floating-point) directive. This outputs floating point values with various kinds of padding and such.

Methods

execute  

Public Instance methods

Outputs the given argument using a floating-point representation. The full form is

  ~w,d,k,overflowchar,padchar@F

with the following interpretations

w (nil)
if non-nil, the output will be exactly w characters long,
d (nil)
if non-nil, this is the number of digits output after the decimal point (.),
k (0)
scaling factor - the number is first scaled using this value,
overflowchar (nil)
if non-nil, this character is used when this directive would produce output longer than that specified with the w directive,
padchar (?\s)
character to pad with if w is non-nil and output isn’t wide enough yet,
@
numbers are always output with sign prepended.

An ArgumentError is raised if the argument is not a number or a string that can be converted to a number.

[Validate]