Skip to content

Commit

Permalink
better collection example
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 2, 2014
1 parent 1d7dd9b commit 5de54e0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/Mojo/Collection.pm
Expand Up @@ -143,16 +143,14 @@ Mojo::Collection - Collection
# Manipulate collection
my $collection = Mojo::Collection->new(qw(just works));
unshift @$collection, 'it';
say $collection->join("\n");
# Chain methods
$collection->map(sub { ucfirst })->shuffle->each(sub {
my ($word, $count) = @_;
say "$count: $word";
});
# Stringify collection
say $collection->join("\n");
# Use the alternative constructor
use Mojo::Collection 'c';
c(qw(a b c))->join('/')->url_escape->say;
Expand Down

0 comments on commit 5de54e0

Please sign in to comment.