blib/lib/UR/Object/Property/View/ReferenceDescription/Text.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 40 SCAR 24.8
CC
3
Cov
0%
_update_view_from_subject
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 12.0
1 package UR::Object::Property::View::ReferenceDescription::Text;
2  
3 use strict;
4 use warnings;
5 require UR;
6 our $VERSION = "0.46"; # UR $VERSION;
7  
8 UR::Object::Type->define(
9 class_name => __PACKAGE__,
10 is => 'UR::Object::View::Default::Text',
11 doc => "View used by 'ur show properties' for each object-accessor property",
12 );
13  
14 sub _update_view_from_subject {
15 my $self = shift;
16  
17 my $property_meta = $self->subject;
18 return unless ($property_meta);
19  
20 my $r_class_name = $property_meta->data_type;
21  
22 my @relation_detail;
23 my @pairs = eval { $property_meta->get_property_name_pairs_for_join() };
24  
25 my $text;
26 if (@pairs) {
27 foreach my $pair ( @pairs ) {
28 my($property_name, $r_property_name) = @$pair;
29 push @relation_detail, "$r_property_name => \$self->$property_name";
30 }
31 my $padding = length($r_class_name) + 34;
32 my $relation_detail = join(",\n" . " "x$padding, @relation_detail);
33  
34 $text = sprintf(" %22s => %s->get(%s)\n",
35 $property_meta->property_name,
36 $r_class_name,
37 $relation_detail);
38 } else {
39 $text = sprintf(" %22s => %s->get(id => \$self->%s)\n",
40 $property_meta->property_name,
41 $r_class_name,
42 $property_meta->property_name);
43 }
44
45 my $widget = $self->widget();
46 my $buffer_ref = $widget->[0];
47 $$buffer_ref = $text;
48 return 1;
49 }
50  
51  
52  
53 1;
54  
55 =pod
56  
57 =head1 NAME
58  
59 UR::Object::Property::View::DescriptionLineItem::Text - View class for UR::Object::Property
60  
61 =head1 DESCRIPTION
62  
63 Used by UR::Namespace::Command::Show::Properties when displaying information about a property
64  
65 =cut