[Bps-public-commit] r15335 - in Prophet/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Thu Aug 21 06:58:03 EDT 2008


Author: sartak
Date: Thu Aug 21 06:58:02 2008
New Revision: 15335

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

Log:
 r70158 at onn:  sartak | 2008-08-21 06:57:02 -0400
 Track arity (record/collection) in reference methods


Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm	(original)
+++ Prophet/trunk/lib/Prophet/Record.pm	Thu Aug 21 06:58:02 2008
@@ -158,7 +158,8 @@
 
     $class->REFERENCES->{$accessor} = {
         %args,
-        type => $collection_class->record_class,
+        arity => 'collection',
+        type  => $collection_class->record_class,
     };
 }
 
@@ -192,7 +193,8 @@
 
     $class->REFERENCES->{$accessor} = {
         %args,
-        type => $record_class,
+        arity => 'scalar',
+        type  => $record_class,
     };
 }
 
@@ -753,6 +755,32 @@
     return $out;
 }
 
+=head2 record_reference_methods
+
+Returns a list of method names that refer to other individual records
+
+=cut
+
+sub record_reference_methods {
+    my $self = shift;
+
+    return grep { $self->REFERENCES->{$_}{arity} eq 'record' }
+           $self->reference_methods;
+}
+
+=head2 collection_reference_methods
+
+Returns a list of method names that refer to collections
+
+=cut
+
+sub collection_reference_methods {
+    my $self = shift;
+
+    return grep { $self->REFERENCES->{$_}{arity} eq 'collection' }
+           $self->reference_methods;
+}
+
 __PACKAGE__->meta->make_immutable;
 no Moose;
 no MooseX::ClassAttribute;



More information about the Bps-public-commit mailing list