Skip to content

Commit

Permalink
as_string method for Ubic::Credentials::*
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyacheslav Matyukhin committed May 22, 2012
1 parent 80a0460 commit f973dd1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Ubic/Credentials.pm
Expand Up @@ -98,6 +98,16 @@ sub set {
croak 'not implemented';
}

=item B<< as_string() >>
Returns human-readable string representation.
=cut
sub as_string {
my $self = shift;
return "$self"; # ugly default stringification; please override in subclasses
}

=back
=cut
Expand Down
7 changes: 7 additions & 0 deletions lib/Ubic/Credentials/OS/POSIX.pm
Expand Up @@ -294,6 +294,13 @@ sub set {
}
}

sub as_string {
my $self = shift;
my $user = $self->user;
my ($group) = $self->group; # ignore complementary groups for the sake of readability
return "$user:$group";
}

=back
=head1 BUGS AND CAVEATS
Expand Down

0 comments on commit f973dd1

Please sign in to comment.