Permalink
Browse files

use k combinator more

  • Loading branch information...
1 parent b6c9cca commit e774ea025df6532251e1c93b508a449654c72858 @kraih committed Aug 18, 2012
Showing with 3 additions and 7 deletions.
  1. +1 −1 lib/Mojo/Base.pm
  2. +1 −3 lib/Mojo/UserAgent.pm
  3. +1 −3 lib/Test/Mojo.pm
View
@@ -123,7 +123,7 @@ Mojo::Base - Minimal base class for Mojo projects
package Tiger;
use Mojo::Base 'Cat';
- has friend => sub { Cat->new };
+ has friend => sub { Cat->new };
has stripes => 42;
package main;
@@ -51,9 +51,7 @@ sub app {
# Default to singleton application
return $self->{app} || $singleton unless $app;
- $self->{app} = $app;
-
- return $self;
+ return $self->tap(sub { $_->{app} = $app });
}
sub app_url {
View
@@ -25,9 +25,7 @@ sub new {
sub app {
my ($self, $app) = @_;
- return $self->ua->app unless $app;
- $self->ua->app($app);
- return $self;
+ return $app ? $self->tap(sub { $_->ua->app($app) }) : $self->ua->app;
}
sub content_is {

0 comments on commit e774ea0

Please sign in to comment.