refactoring even more
[gitmo/MooseX-MetaDescription.git] / lib / MooseX / MetaDescription / Meta / Attribute / Trait.pm
index d7ee8d5..5de2617 100644 (file)
@@ -1,16 +1,34 @@
 package MooseX::MetaDescription::Meta::Attribute::Trait;
 use Moose::Role;
 
-use MooseX::MetaDescription::Description::Attribute;
-
 our $VERSION   = '0.01';
 our $AUTHORITY = 'cpan:STEVAN';
 
-with 'MooseX::MetaDescription::Meta::Role::HasMetaDescription';
+has 'description' => (
+    is      => 'ro',
+    isa     => 'HashRef',
+    lazy    => 1,   
+    default => sub { +{} },
+);
+
+has 'metadescription_classname' => (
+    is      => 'ro',
+    isa     => 'Str', 
+    default => sub {
+        'MooseX::MetaDescription::Description'
+    }  
+);
 
-has '+metadescription_classname' => (
-    default => sub { 
-        'MooseX::MetaDescription::Description::Attribute' 
+has 'metadescription' => (
+    is      => 'ro',
+    isa     => 'MooseX::MetaDescription::Description',
+    lazy    => 1,   
+    default => sub {
+        my $self = shift;
+        $self->metadescription_classname->new(
+            %{ $self->description },
+            descriptor => $self,
+        )
     },
 );