Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use the term callback consistently
  • Loading branch information
kraih committed Aug 25, 2012
1 parent c35e753 commit fe4aecc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/Base.pm
Expand Up @@ -213,8 +213,8 @@ pass it either a hash or a hash reference with attribute values.
Create attributes for hash-based objects. An array reference can be used to
create more than one attribute. Pass an optional second argument to set a
default value, it should be a constant or a sub reference. The sub reference
will be excuted at accessor read time if there's no set value.
default value, it should be a constant or a callback. The callback will be
excuted at accessor read time if there's no set value.
=head2 C<tap>
Expand Down
14 changes: 7 additions & 7 deletions lib/Mojo/Collection.pm
Expand Up @@ -143,7 +143,7 @@ Construct a new array-based L<Mojo::Collection> object.
my @elements = $collection->each;
$collection = $collection->each(sub {...});
Evaluate closure for each element in collection.
Evaluate callback for each element in collection.
$collection->each(sub {
my ($e, $count) = @_;
Expand All @@ -156,9 +156,9 @@ Evaluate closure for each element in collection.
my $first = $collection->first(qr/foo/);
my $first = $collection->first(sub {...});
Evaluate regular expression or closure for each element in collection and
Evaluate regular expression or callback for each element in collection and
return the first one that matched the regular expression, or for which the
closure returned true.
callback returned true.
my $five = $collection->first(sub { $_ == 5 });
Expand All @@ -167,9 +167,9 @@ closure returned true.
my $new = $collection->grep(qr/foo/);
my $new = $collection->grep(sub {...});
Evaluate regular expression or closure for each element in collection and
Evaluate regular expression or callback for each element in collection and
create a new collection with all elements that matched the regular expression,
or for which the closure returned true.
or for which the callback returned true.
my $interesting = $collection->grep(qr/mojo/i);
Expand All @@ -185,7 +185,7 @@ Turn collection into L<Mojo::ByteStream>.
my $new = $collection->map(sub {...});
Evaluate closure for each element in collection and create a new collection
Evaluate callback for each element in collection and create a new collection
from the results.
my $doubled = $collection->map(sub { $_ * 2 });
Expand Down Expand Up @@ -230,7 +230,7 @@ Number of elements in collection.
my $new = $collection->sort;
my $new = $collection->sort(sub {...});
Sort elements based on return value of closure and create a new collection
Sort elements based on return value of callback and create a new collection
from the results.
my $insensitive = $collection->sort(sub { uc(shift) cmp uc(shift) });
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -525,7 +525,7 @@ and a call to C<dispatch> the last, yours will be in between.
This is a very powerful hook and should not be used lightly, it allows you to
customize application wide exception handling for example, consider it the
sledgehammer in your toolbox. (Passed a closure leading to the next hook and
sledgehammer in your toolbox. (Passed a callback leading to the next hook and
the default controller object)
=back
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/base.t
Expand Up @@ -72,7 +72,7 @@ for my $i (101 .. 150) {
: is($monkeys[$i]->heads, 1, 'right attribute default value');
}

# Chained attributes and coderef default value support
# Chained attributes and callback default value support
for my $i (151 .. 200) {
$monkeys[$i] = Mojo::BaseTest->new;
is $monkeys[$i]->ears, 2, 'right attribute value';
Expand Down
4 changes: 2 additions & 2 deletions t/mojo/response.t
Expand Up @@ -619,10 +619,10 @@ isa_ok $invocant, 'Mojo::Message::Response', 'right invocant';
$res = Mojo::Message::Response->new;
$res->code(200);
$res->headers->content_length(10);
$res->write('lala' => sub { die "Body coderef was called properly\n" });
$res->write('lala' => sub { die "Body callback was called properly\n" });
$res->get_body_chunk(0);
eval { $res->get_body_chunk(3) };
is $@, "Body coderef was called properly\n", 'right error';
is $@, "Body callback was called properly\n", 'right error';

# Build response with callback (consistency calls)
$res = Mojo::Message::Response->new;
Expand Down

0 comments on commit fe4aecc

Please sign in to comment.