From: Chris Prather Date: Sun, 9 Aug 2009 21:19:23 +0000 (-0400) Subject: add a brief SYNOPSIS for each type to the Native docs X-Git-Tag: 0.89_02~72 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=52e0d71f1330a627f75b6291d5747834be17e075;p=gitmo%2FMoose.git add a brief SYNOPSIS for each type to the Native docs --- diff --git a/lib/Moose/Attribute/Native.pm b/lib/Moose/Attribute/Native.pm index dbbc38b..dc63346 100644 --- a/lib/Moose/Attribute/Native.pm +++ b/lib/Moose/Attribute/Native.pm @@ -1,4 +1,3 @@ - package Moose::Attribute::Native; our $VERSION = '0.87'; @@ -103,33 +102,101 @@ works normally for C<< handles >>. Common numerical operations. + has 'integer' => ( + metaclass => 'Number', + is => 'ro', + isa => 'Int', + default => 5, + handles => { + set => 'set', + add => 'add', + sub => 'sub', + mul => 'mul', + div => 'div', + mod => 'mod', + abs => 'abs', + } + ); + =item L Common methods for string operations. + has 'text' => ( + metaclass => 'String', + is => 'rw', + isa => 'Str', + default => q{}, + handles => { + add_text => 'append', + replace_text => 'replace', + } + ); + =item L Methods for incrementing and decrementing a counter attribute. + has 'counter' => ( + traits => ['Counter'], + is => 'ro', + isa => 'Num', + default => 0, + handles => { + inc_counter => 'inc', + dec_counter => 'dec', + reset_counter => 'reset', + } + ); + =item L Common methods for boolean values. + has 'is_lit' => ( + traits => ['Bool'], + is => 'rw', + isa => 'Bool', + default => 0, + handles => { + illuminate => 'set', + darken => 'unset', + flip_switch => 'toggle', + is_dark => 'not', + } + ); + + =item L Common methods for hash references. -=item L - -Common methods for inspecting hash references. + has 'options' => ( + traits => ['Hash'], + is => 'ro', + isa => 'HashRef[Str]', + default => sub { {} }, + handles => { + set_option => 'set', + get_option => 'get', + has_option => 'exists', + } + ); =item L Common methods for array references. -=item L - -Common list methods for array references. + has 'queue' => ( + traits => ['Array'], + is => 'ro', + isa => 'ArrayRef[Str]', + default => sub { [] }, + handles => { + add_item => 'push' + next_item => 'shift', + } + ); =back