[Bps-public-commit] r14945 - in Prophet/trunk: . lib/Prophet/CLI/Command

sartak at bestpractical.com sartak at bestpractical.com
Sat Aug 9 12:45:57 EDT 2008


Author: sartak
Date: Sat Aug  9 12:45:57 2008
New Revision: 14945

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/CLI/Command/History.pm
   Prophet/trunk/lib/Prophet/Record.pm

Log:
 r69006 at onn:  sartak | 2008-08-09 12:45:50 -0400
 Go one further: Record->history_as_string


Modified: Prophet/trunk/lib/Prophet/CLI/Command/History.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/History.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/History.pm	Sat Aug  9 12:45:57 2008
@@ -9,12 +9,7 @@
     $self->require_uuid;
     my $record = $self->_load_record;
 
-    print "History for record " . $record->luid . " (" . $record->uuid . ")\n\n";
-    for my $changeset ($record->changesets) {
-        print $changeset->as_string(change_filter => sub {
-            shift->record_uuid eq $record->uuid
-        });
-    }
+    print $record->history_as_string;
 }
 
 __PACKAGE__->meta->make_immutable;

Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm	(original)
+++ Prophet/trunk/lib/Prophet/Record.pm	Sat Aug  9 12:45:57 2008
@@ -669,6 +669,28 @@
     return ($property, $value);
 }
 
+=head2 history_as_string
+
+Returns this record's changesets as a single string.
+
+=cut
+
+sub history_as_string {
+    my $self = shift;
+    my $out = "History for record "
+            . $self->luid
+            . " (" . $self->uuid . ")"
+            . "\n\n";
+
+    for my $changeset ($self->changesets) {
+        $out .= $changeset->as_string(change_filter => sub {
+            shift->record_uuid eq $self->uuid
+        });
+    }
+
+    return $out;
+}
+
 __PACKAGE__->meta->make_immutable;
 no Moose;
 no MooseX::ClassAttribute;



More information about the Bps-public-commit mailing list