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

sartak at bestpractical.com sartak at bestpractical.com
Mon Sep 1 20:47:45 EDT 2008


Author: sartak
Date: Mon Sep  1 20:47:43 2008
New Revision: 15686

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

Log:
 r70818 at onn:  sartak | 2008-09-01 20:47:25 -0400
 REFERENCES needs to be keyed by class name, so comment's references are not conflated with ticket's references


Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm	(original)
+++ Prophet/trunk/lib/Prophet/Record.pm	Mon Sep  1 20:47:43 2008
@@ -50,14 +50,10 @@
 );
 
 class_has REFERENCES => (
-    metaclass => 'Collection::Hash',
     is        => 'rw',
     isa       => 'HashRef',
     default   => sub { {} },
-    provides  => {
-        keys => 'reference_methods',
-    },
-    documentation => 'A hash of accessor_name => collection_class references.',
+    documentation => 'A hash of class_name => references.',
 );
 
 class_has PROPERTIES => (
@@ -161,7 +157,7 @@
 
     # XXX: add validater for $args{by} in $model->record_class
 
-    $class->REFERENCES->{$accessor} = {
+    $class->REFERENCES->{$class}{$accessor} = {
         %args,
         arity => 'collection',
         type  => $collection_class->record_class,
@@ -196,7 +192,7 @@
 
     # XXX: add validater for $args{by} in $model->record_class
 
-    $class->REFERENCES->{$accessor} = {
+    $class->REFERENCES->{$class}{$accessor} = {
         %args,
         arity => 'scalar',
         type  => $record_class,
@@ -768,9 +764,11 @@
 
 sub record_reference_methods {
     my $self = shift;
+    my $class = blessed($self) || $self;
+    my %accessors = %{ $self->REFERENCES->{$class} || {} };
 
-    return grep { $self->REFERENCES->{$_}{arity} eq 'record' }
-           $self->reference_methods;
+    return grep { $accessors{$_}{arity} eq 'record' }
+           keys %accessors;
 }
 
 =head2 collection_reference_methods
@@ -781,9 +779,11 @@
 
 sub collection_reference_methods {
     my $self = shift;
+    my $class = blessed($self) || $self;
+    my %accessors = %{ $self->REFERENCES->{$class} || {} };
 
-    return grep { $self->REFERENCES->{$_}{arity} eq 'collection' }
-           $self->reference_methods;
+    return grep { $accessors{$_}{arity} eq 'collection' }
+           keys %accessors;
 }
 
 __PACKAGE__->meta->make_immutable;



More information about the Bps-public-commit mailing list