[Bps-public-commit] r12468 - in Prophet/branches/moose: .

sartak at bestpractical.com sartak at bestpractical.com
Sat May 17 07:03:23 EDT 2008


Author: sartak
Date: Sat May 17 07:03:22 2008
New Revision: 12468

Modified:
   Prophet/branches/moose/   (props changed)
   Prophet/branches/moose/lib/Prophet/Conflict.pm
   Prophet/branches/moose/lib/Prophet/ConflictingChange.pm

Log:
 r56204 at onn:  sartak | 2008-05-17 07:03:11 -0400
 Moosify prop_conflicts


Modified: Prophet/branches/moose/lib/Prophet/Conflict.pm
==============================================================================
--- Prophet/branches/moose/lib/Prophet/Conflict.pm	(original)
+++ Prophet/branches/moose/lib/Prophet/Conflict.pm	Sat May 17 07:03:22 2008
@@ -138,10 +138,10 @@
         my $current_state
             = $self->prophet_handle->get_record_props( uuid => $change->record_uuid, type => $change->record_type );
 
-        push @{ $change_conflict->prop_conflicts }, $self->_generate_prop_change_conflicts( $change, $current_state );
+        $change_conflict->add_prop_conflict($self->_generate_prop_change_conflicts( $change, $current_state ));
     }
 
-    return ( @{ $change_conflict->prop_conflicts } || $file_op_conflict ) ? $change_conflict : undef;
+    return ( $change_conflict->has_prop_conflicts || $file_op_conflict ) ? $change_conflict : undef;
 }
 
 =head2 _generate_prop_change_conflicts Prophet::Change %hash_of_current_properties

Modified: Prophet/branches/moose/lib/Prophet/ConflictingChange.pm
==============================================================================
--- Prophet/branches/moose/lib/Prophet/ConflictingChange.pm	(original)
+++ Prophet/branches/moose/lib/Prophet/ConflictingChange.pm	Sat May 17 07:03:22 2008
@@ -1,5 +1,6 @@
 package Prophet::ConflictingChange;
 use Moose;
+use MooseX::AttributeHelpers;
 use Prophet::Meta::Types;
 use Prophet::ConflictingPropChange;
 use JSON 'to_json';
@@ -35,20 +36,16 @@
     isa => 'Prophet::Type::FileOpConflict',
 );
 
-=head2 prop_conflicts
-
-Returns a reference to an array of Prophet::ConflictingPropChange objects
-
-=cut
-
-sub prop_conflicts {
-    my $self = shift;
-
-    $self->{'prop_conflicts'} ||= [];
-    return $self->{prop_conflicts};
-
-}
-
+has prop_conflicts => (
+    metaclass => 'Collection::Array',
+    is        => 'rw',
+    isa       => 'ArrayRef',
+    default   => sub { [] },
+    provides  => {
+        push  => 'add_prop_conflict',
+        count => 'has_prop_conflicts',
+    },
+);
 
 sub as_hash {
     my $self = shift;



More information about the Bps-public-commit mailing list