[Bps-public-commit] r16121 - in Prophet/branches/dispatcher: lib/Prophet

sartak at bestpractical.com sartak at bestpractical.com
Sat Sep 27 17:16:21 EDT 2008


Author: sartak
Date: Sat Sep 27 17:16:21 2008
New Revision: 16121

Modified:
   Prophet/branches/dispatcher/   (props changed)
   Prophet/branches/dispatcher/lib/Prophet/CLIContext.pm

Log:
 r72990 at onn:  sartak | 2008-09-27 17:15:35 -0400
 Move get_collection_object to CLIContext


Modified: Prophet/branches/dispatcher/lib/Prophet/CLIContext.pm
==============================================================================
--- Prophet/branches/dispatcher/lib/Prophet/CLIContext.pm	(original)
+++ Prophet/branches/dispatcher/lib/Prophet/CLIContext.pm	Sat Sep 27 17:16:21 2008
@@ -345,6 +345,25 @@
     return 'Prophet::Record';
 }
 
+sub get_collection_object {
+    my $self = shift;
+    my %args = validate(@_, {
+        type => { default => $self->type },
+    });
+
+    my $record_class = $self->_get_record_object(type => $args{type});
+    my $class = $record_class->collection_class;
+    Prophet::App->require($class);
+
+    my $records = $class->new(
+        app_handle => $self->app_handle,
+        handle     => $self->handle,
+        type       => $args{type} || $self->type,
+    );
+
+    return $records;
+}
+
 =head2 require_uuid
 
 Checks to make sure the uuid attribute is set. Prints an error and dies



More information about the Bps-public-commit mailing list