prep next release
[gitmo/Moose-Autobox.git] / lib / Moose / Autobox / Number.pm
index e45d14d..1dcbb08 100644 (file)
@@ -1,10 +1,15 @@
 package Moose::Autobox::Number;
 use Moose::Role;
 
-our $VERSION = '0.01';
+our $VERSION = '0.13';
 
 with 'Moose::Autobox::Value';
-     
+
+sub to {
+    return [ $_[0] .. $_[1] ] if $_[0] <= $_[1];
+    return [ reverse $_[1] .. $_[0] ];
+}
+
 1;
 
 __END__
@@ -15,12 +20,32 @@ __END__
 
 Moose::Autobox::Number - the Number role
 
-=head1 SYNOPOSIS
+=head1 DESCRIPTION
 
-  use Moose::Autobox;
-  use autobox;
+This is a role to describes a Numeric value. 
 
-=head1 DESCRIPTION
+=head1 METHODS
+
+=over 4
+
+=item B<to>
+
+Takes another number as argument and produces an array ranging from
+the number the method is called on to the number given as argument. In
+some situations, this method intentionally behaves different from the
+range operator in perl:
+
+  $foo = [ 5 .. 1 ]; # $foo is []
+
+  $foo = 5->to(1);   # $foo is [ 5, 4, 3, 2, 1 ]
+
+=back
+
+=over 4
+
+=item B<meta>
+
+=back
 
 =head1 BUGS
 
@@ -34,11 +59,11 @@ Stevan Little E<lt>stevan@iinteractive.comE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2006 by Infinity Interactive, Inc.
+Copyright 2006-2008 by Infinity Interactive, Inc.
 
 L<http://www.iinteractive.com>
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
-=cut
\ No newline at end of file
+=cut