Skip to content

Commit 19c680e

Browse files
committed
Merge pull request #4641 from alco/alco/base-docfix
Fix the documentation for functions in Base
2 parents 5a3a85a + 0984e8c commit 19c680e

File tree

1 file changed

+130
-40
lines changed

1 file changed

+130
-40
lines changed

lib/elixir/lib/base.ex

Lines changed: 130 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,16 @@ defmodule Base do
150150
@doc """
151151
Encodes a binary string into a base 16 encoded string.
152152
153-
Accepts an atom `:upper` (default) for encoding to upper case characters or
154-
`:lower` for lower case characters.
153+
## Options
154+
155+
The accepted options are:
156+
157+
* `:case` - specifies the character case to use when encoding
158+
159+
The values for `:case` can be:
160+
161+
* `:upper` - use upper case characters (default)
162+
* `:lower` - use lower case characters
155163
156164
## Examples
157165
@@ -172,9 +180,17 @@ defmodule Base do
172180
@doc """
173181
Decodes a base 16 encoded string into a binary string.
174182
175-
Accepts an atom `:upper` (default) for decoding from upper case characters or
176-
`:lower` for lower case characters. `:mixed` can be given for mixed case
177-
characters.
183+
## Options
184+
185+
The accepted options are:
186+
187+
* `:case` - specifies the character case to accept when decoding
188+
189+
The values for `:case` can be:
190+
191+
* `:upper` - only allow upper case characters (default)
192+
* `:lower` - only allow lower case characters
193+
* `:mixed` - allow mixed case characters
178194
179195
## Examples
180196
@@ -199,9 +215,17 @@ defmodule Base do
199215
@doc """
200216
Decodes a base 16 encoded string into a binary string.
201217
202-
Accepts an atom `:upper` (default) for decoding from upper case characters or
203-
`:lower` for lower case characters. `:mixed` can be given for mixed case
204-
characters.
218+
## Options
219+
220+
The accepted options are:
221+
222+
* `:case` - specifies the character case to accept when decoding
223+
224+
The values for `:case` can be:
225+
226+
* `:upper` - only allow upper case characters (default)
227+
* `:lower` - only allow lower case characters
228+
* `:mixed` - allow mixed case characters
205229
206230
An `ArgumentError` exception is raised if the padding is incorrect or
207231
a non-alphabet character is present in the string.
@@ -410,11 +434,22 @@ defmodule Base do
410434
@doc """
411435
Encodes a binary string into a base 32 encoded string.
412436
413-
Accepts an atom `:upper` (default) for encoding to upper case characters or
414-
`:lower` for lower case characters.
437+
## Options
415438
416-
Accepts `padding: false` option which will omit padding from
417-
the output string.
439+
The accepted options are:
440+
441+
* `:case` - specifies the character case to use when encoding
442+
* `:padding` - specifies whether to apply padding
443+
444+
The values for `:case` can be:
445+
446+
* `:upper` - use upper case characters (default)
447+
* `:lower` - use lower case characters
448+
449+
The values for `:padding` can be:
450+
451+
* `true` - pad the output string to the nearest multiple of 8 (default)
452+
* `false` - omit padding from the output string
418453
419454
## Examples
420455
@@ -439,12 +474,23 @@ defmodule Base do
439474
@doc """
440475
Decodes a base 32 encoded string into a binary string.
441476
442-
Accepts an atom `:upper` (default) for decoding from upper case characters or
443-
`:lower` for lower case characters. `:mixed` can be given for mixed case
444-
characters.
477+
## Options
445478
446-
Accepts `padding: false` option which will ignore padding from
447-
the input string.
479+
The accepted options are:
480+
481+
* `:case` - specifies the character case to accept when decoding
482+
* `:padding` - specifies whether to require padding
483+
484+
The values for `:case` can be:
485+
486+
* `:upper` - only allow upper case characters (default)
487+
* `:lower` - only allow lower case characters
488+
* `:mixed` - allow mixed case characters
489+
490+
The values for `:padding` can be:
491+
492+
* `true` - require the input string to be padded to the nearest multiple of 8 (default)
493+
* `false` - ignore padding from the input string
448494
449495
## Examples
450496
@@ -472,16 +518,27 @@ defmodule Base do
472518
@doc """
473519
Decodes a base 32 encoded string into a binary string.
474520
475-
Accepts an atom `:upper` (default) for decoding from upper case characters or
476-
`:lower` for lower case characters. `:mixed` can be given for mixed case
477-
characters.
478-
479-
Accepts `padding: false` option which will ignore padding from
480-
the input string.
481-
482521
An `ArgumentError` exception is raised if the padding is incorrect or
483522
a non-alphabet character is present in the string.
484523
524+
## Options
525+
526+
The accepted options are:
527+
528+
* `:case` - specifies the character case to accept when decoding
529+
* `:padding` - specifies whether to require padding
530+
531+
The values for `:case` can be:
532+
533+
* `:upper` - only allow upper case characters (default)
534+
* `:lower` - only allow lower case characters
535+
* `:mixed` - allow mixed case characters
536+
537+
The values for `:padding` can be:
538+
539+
* `true` - require the input string to be padded to the nearest multiple of 8 (default)
540+
* `false` - ignore padding from the input string
541+
485542
## Examples
486543
487544
iex> Base.decode32!("MZXW6YTBOI======")
@@ -509,11 +566,22 @@ defmodule Base do
509566
Encodes a binary string into a base 32 encoded string with an
510567
extended hexadecimal alphabet.
511568
512-
Accepts an atom `:upper` (default) for encoding to upper case characters or
513-
`:lower` for lower case characters.
569+
## Options
514570
515-
Accepts `padding: false` option which will omit padding from
516-
the output string.
571+
The accepted options are:
572+
573+
* `:case` - specifies the character case to use when encoding
574+
* `:padding` - specifies whether to apply padding
575+
576+
The values for `:case` can be:
577+
578+
* `:upper` - use upper case characters (default)
579+
* `:lower` - use lower case characters
580+
581+
The values for `:padding` can be:
582+
583+
* `true` - pad the output string to the nearest multiple of 8 (default)
584+
* `false` - omit padding from the output string
517585
518586
## Examples
519587
@@ -539,12 +607,23 @@ defmodule Base do
539607
Decodes a base 32 encoded string with extended hexadecimal alphabet
540608
into a binary string.
541609
542-
Accepts an atom `:upper` (default) for decoding from upper case characters or
543-
`:lower` for lower case characters. `:mixed` can be given for mixed case
544-
characters.
610+
## Options
545611
546-
Accepts `padding: false` option which will ignore padding from
547-
the input string.
612+
The accepted options are:
613+
614+
* `:case` - specifies the character case to accept when decoding
615+
* `:padding` - specifies whether to require padding
616+
617+
The values for `:case` can be:
618+
619+
* `:upper` - only allow upper case characters (default)
620+
* `:lower` - only allow lower case characters
621+
* `:mixed` - allow mixed case characters
622+
623+
The values for `:padding` can be:
624+
625+
* `true` - require the input string to be padded to the nearest multiple of 8 (default)
626+
* `false` - ignore padding from the input string
548627
549628
## Examples
550629
@@ -573,16 +652,27 @@ defmodule Base do
573652
Decodes a base 32 encoded string with extended hexadecimal alphabet
574653
into a binary string.
575654
576-
Accepts an atom `:upper` (default) for decoding from upper case characters or
577-
`:lower` for lower case characters. `:mixed` can be given for mixed case
578-
characters.
579-
580-
Accepts `padding: false` option which will ignore padding from
581-
the input string.
582-
583655
An `ArgumentError` exception is raised if the padding is incorrect or
584656
a non-alphabet character is present in the string.
585657
658+
## Options
659+
660+
The accepted options are:
661+
662+
* `:case` - specifies the character case to accept when decoding
663+
* `:padding` - specifies whether to require padding
664+
665+
The values for `:case` can be:
666+
667+
* `:upper` - only allow upper case characters (default)
668+
* `:lower` - only allow lower case characters
669+
* `:mixed` - allow mixed case characters
670+
671+
The values for `:padding` can be:
672+
673+
* `true` - require the input string to be padded to the nearest multiple of 8 (default)
674+
* `false` - ignore padding from the input string
675+
586676
## Examples
587677
588678
iex> Base.hex_decode32!("CPNMUOJ1E8======")

0 commit comments

Comments
 (0)