File tree Expand file tree Collapse file tree 1 file changed +1
-38
lines changed Expand file tree Collapse file tree 1 file changed +1
-38
lines changed Original file line number Diff line number Diff line change @@ -775,48 +775,11 @@ Defined as:
775
775
776
776
method enums()
777
777
778
- Returns the list of enum-pairs. Works both on the enum type and any key.
778
+ Returns the list of enum-pairs.
779
779
780
780
enum Mass ( mg => 1/1000, g => 1/1, kg => 1000/1 );
781
781
say Mass.enums; # OUTPUT: «{g => 1, kg => 1000, mg => 0.001}»
782
782
783
- = head4 method key
784
-
785
- Returns the key of an enum-pair.
786
-
787
- = for code :preamble<<enum Mass<g> >>
788
- say g.key; # OUTPUT: «g»
789
-
790
- = head4 method value
791
-
792
- Returns the value of an enum-pair.
793
-
794
- = for code :preamble<<enum Mass<g> >>
795
- say g.value; # OUTPUT: «1»
796
-
797
- = head4 method pair
798
-
799
- Defined as:
800
-
801
- = for code
802
- method pair(::?CLASS:D:)
803
-
804
- Returns the enum-pair as a C < Pair > .
805
-
806
- = for code :preamble<<enum Mass<g> >>
807
- say g.pair; # OUTPUT: «g => 1»
808
-
809
- = head4 method kv
810
-
811
- Defined as:
812
-
813
- = for code
814
- multi method kv(::?CLASS:D:)
815
-
816
- Returns a list with key and value of the enum-pair.
817
-
818
- = for code :preamble<<enum Mass<g> >>
819
- say g.kv; # OUTPUT: «(g 1)»
820
783
821
784
= head3 Coercion
822
785
You can’t perform that action at this time.
0 commit comments