summary refs log tree commit diff
path: root/lib/MooseX
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-06-08 11:24:12 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-08 11:24:12 +0200
commited2f44f5b8ef7a0127abcfb0bbffc52945dc266c (patch)
tree45b5e65a99c2c3c270c8dec4612298e528848adb /lib/MooseX
parentrename find_param to find_request_parameter (diff)
downloadmoosex-net-api-ed2f44f5b8ef7a0127abcfb0bbffc52945dc266c.tar.gz
add documentation to method
Diffstat (limited to '')
-rw-r--r--lib/MooseX/Net/API/Meta/Method.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/MooseX/Net/API/Meta/Method.pm b/lib/MooseX/Net/API/Meta/Method.pm
index 29be4fc..9a9ab09 100644
--- a/lib/MooseX/Net/API/Meta/Method.pm
+++ b/lib/MooseX/Net/API/Meta/Method.pm
@@ -69,6 +69,25 @@ has required => (
     auto_deref => 1,
     required   => 0,
 );
+has documentation => (
+    is      => 'ro',
+    isa     => 'Str',
+    lazy    => 1,
+    default => sub {
+        my $self = shift;
+        my $doc;
+        $doc .= "name:        " . $self->name . "\n";
+        $doc .= "description: " . $self->description . "\n"
+          if $self->has_description;
+        $doc .= "method:      " . $self->method . "\n";
+        $doc .= "path:        " . $self->path . "\n";
+        $doc .= "arguments:   " . join(', ', $self->params) . "\n"
+          if $self->params;
+        $doc .= "required:    " . join(', ', $self->required) . "\n"
+          if $self->required;
+        $doc;
+    }
+);
 
 before wrap => sub {
     my ($class, %args) = @_;