Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Moving 'enum-pair' definitions to its real place, Enumeration
  • Loading branch information
JJ committed Aug 1, 2018
1 parent 1cdd59e commit 7676e00
Showing 1 changed file with 1 addition and 38 deletions.
39 changes: 1 addition & 38 deletions doc/Language/typesystem.pod6
Expand Up @@ -775,48 +775,11 @@ Defined as:
method enums()
Returns the list of enum-pairs. Works both on the enum type and any key.
Returns the list of enum-pairs.
enum Mass ( mg => 1/1000, g => 1/1, kg => 1000/1 );
say Mass.enums; # OUTPUT: «{g => 1, kg => 1000, mg => 0.001}␤»
=head4 method key
Returns the key of an enum-pair.
=for code :preamble<<enum Mass<g> >>
say g.key; # OUTPUT: «g␤»
=head4 method value
Returns the value of an enum-pair.
=for code :preamble<<enum Mass<g> >>
say g.value; # OUTPUT: «1␤»
=head4 method pair
Defined as:
=for code
method pair(::?CLASS:D:)
Returns the enum-pair as a C<Pair>.
=for code :preamble<<enum Mass<g> >>
say g.pair; # OUTPUT: «g => 1␤»
=head4 method kv
Defined as:
=for code
multi method kv(::?CLASS:D:)
Returns a list with key and value of the enum-pair.
=for code :preamble<<enum Mass<g> >>
say g.kv; # OUTPUT: «(g 1)␤»
=head3 Coercion
Expand Down

0 comments on commit 7676e00

Please sign in to comment.