[Bps-public-commit] r15967 - in Prophet/trunk: .
spang at bestpractical.com
spang at bestpractical.com
Sat Sep 13 20:41:09 EDT 2008
Author: spang
Date: Sat Sep 13 20:41:06 2008
New Revision: 15967
Modified:
Prophet/trunk/ (props changed)
Prophet/trunk/lib/Prophet/Change.pm
Prophet/trunk/lib/Prophet/ChangeSet.pm
Log:
r49798 at loki: spang | 2008-09-13 19:36:38 -0400
Fix some warnings noise in record history and doc the as_string subs
while I'm at it
Modified: Prophet/trunk/lib/Prophet/Change.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Change.pm (original)
+++ Prophet/trunk/lib/Prophet/Change.pm Sat Sep 13 20:41:06 2008
@@ -121,12 +121,20 @@
};
}
+=head2 as_string ARGS
+
+Returns a string representing this change. If C<$args{header_callback}>
+is specified, the string returned from passing C<$self> to the callback
+is prepended to the change string before it is returned.
+
+=cut
+
sub as_string {
my $self = shift;
my %args = validate( @_, { header_callback => 0, } );
- my $out = "";
+ my $out = '';
my @prop_changes = $self->prop_changes;
- return undef if @prop_changes == 0;
+ return '' if @prop_changes == 0;
$out .= $args{header_callback}->($self) if ( $args{header_callback} );
for my $prop_change (@prop_changes) {
Modified: Prophet/trunk/lib/Prophet/ChangeSet.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/ChangeSet.pm (original)
+++ Prophet/trunk/lib/Prophet/ChangeSet.pm Sat Sep 13 20:41:06 2008
@@ -160,6 +160,26 @@
return $self;
}
+=head2 as_string ARGS
+
+Returns a single string representing the changes in this changeset.
+
+If C<$args{header_callback}> is defined, the string returned from passing
+C<$self> to the callback is prepended to the changeset string before it is
+returned (instead of L</description_as_string>).
+
+If C<$args{skip_empty}> is defined, an empty string is returned if the
+changeset contains no changes.
+
+The argument C<change_filter> can be used to filter certain changes from
+the string representation; the function is passed a change and should return
+false if that change should be skipped.
+
+The C<change_header> argument, if present, is passed to
+C<$change-E<gt>to_string> when individual changes are converted to strings.
+
+=cut
+
sub as_string {
my $self = shift;
my %args = validate(
@@ -171,7 +191,6 @@
}
);
-
my $body = '';
for my $change ( $self->changes ) {
@@ -187,6 +206,12 @@
return $out;
}
+=head2 description_as_change
+
+Returns a string representing a description of this string.
+
+=cut
+
sub description_as_string {
my $self = shift;
sprintf "Change %d by %s at %s\n\t\t\t\t\(%d@%s)\n\n",
More information about the Bps-public-commit
mailing list