Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added usage statements for C<antipair>, C<value>, C<cmp>, C<fmt>, C<kv>,
and C<pairs>
  • Loading branch information
dha committed Oct 3, 2015
1 parent 2d7c132 commit cac4619
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions lib/Type/Pair.pod
Expand Up @@ -28,8 +28,14 @@ The immutable version of a C<Pair> is an C<Enum>.
=head2 method antipair
Defined as:
method antipair() returns Pair:D
Usage:
PAIR.antipair
Returns a new C<Pair> object with key and value exchanged.
my $p = (6 => 'Perl').antipair;
Expand All @@ -38,21 +44,39 @@ Returns a new C<Pair> object with key and value exchanged.
=head2 method value
Defined as:
multi method value(Pair:D:) is rw
Usage:
PAIR.value
Returns the I<value> part of the C<Pair>.
=head2 infix cmp
Defined as:
multi sub infix:<cmp>(Pair:D, Pair:D)
Usage:
PAIR1 cmp PAIR2
The type-agnostic comparator; compares two C<Pair>s. Compares first their
I<key> parts, and then compares the I<value> parts if the keys are equal.
=head2 method fmt
Defined as:
multi method fmt(Pair:D:) returns Str:D
Usage:
PAIR.fmt(FORMATSTRING)
Takes a I<format string>, and returns a string the I<key> and I<value>
parts of the C<Pair> formatted. Here's an example:
Expand All @@ -64,17 +88,29 @@ For more about format strings, see L<sprintf>.
=head2 method kv
Defined as:
multi method kv(Pair:D:) returns List:D
Usage:
PAIR.kv
Returns a two-element C<List> with the I<key> and I<value> parts of
C<Pair>, in that order. This method is a special case of the same-named
method on C<Hash>, which returns all its entries as a list of keys and
values.
=head2 method pairs
Defined as:
multi method pairs(Pair:D:)
Usage:
PAIR.pairs
Returns a list of one C<Pair>, namely this one.
=end pod

0 comments on commit cac4619

Please sign in to comment.