Rename Object->contents to ->content, and delegate to GPP.
[catagits/Gitalist.git] / lib / Gitalist / Git / Object.pm
index ff33b8d..3addbb6 100644 (file)
@@ -40,14 +40,14 @@ class Gitalist::Git::Object {
 
     # This feels wrong, but current templates assume
     # these attributes are present on every object.
-    foreach my $key (qw/tree_sha1 comment/) {
+    foreach my $key (qw/tree_sha1 comment content/) {
         has $key => ( isa => Str,
                       required => 1,
                       is => 'ro',
                       lazy_build => 1,
                   );
         method "_build_$key" {
-            return '' unless $self->_gpp_obj->can($key);
+            confess("Object can't " . $key) unless $self->_gpp_obj->can($key);
             return $self->_gpp_obj->$key;
         }
     }
@@ -84,19 +84,4 @@ class Gitalist::Git::Object {
         $self->_run_cmd('cat-file', '-' . $flag, $self->{sha1})
     }
 
-=head2 contents
-
-Return the contents of a given file.
-
-=cut
-
-    # FIXME - Should be an attribute so it gets cached?
-    method contents {
-        if ( $self->type ne 'blob' ) {
-            die "object $self->sha1 is not a file\n"
-        }
-
-        $self->_cat_file_with_flag('p');
-    }
-
 } # end class