Skip to content

Instantly share code, notes, and snippets.

/-

Created August 18, 2017 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1928c19ba608f56cddd1066b72f08849 to your computer and use it in GitHub Desktop.
Save anonymous/1928c19ba608f56cddd1066b72f08849 to your computer and use it in GitHub Desktop.
diff --git a/lib/Mojo/Base.pm b/lib/Mojo/Base.pm
index c6ea0aa50..ba95d90a1 100644
--- a/lib/Mojo/Base.pm
+++ b/lib/Mojo/Base.pm
@@ -259,10 +259,11 @@ spliced or tapped into) a chained set of object method calls.
my $new_class = SubClass->with_roles('+One', '+Two');
$object = $object->with_roles('+One', '+Two');
-Create a new class with one or more L<Role::Tiny> roles and return it, or
-rebless the given object into it. For roles following the naming scheme
-C<MyClass::Role::RoleName> you can use the shorthand C<+RoleName>. Note that
-role support depends on L<Role::Tiny> (2.000001+).
+Call with_roles on a class or object to apply the given list of roles
+to the object or class and return the modified invocant. For objects this
+will actually rebless the passed argument as well. If the role follows
+the name scheme C<MyClass::Role::RoleName> you can use the shorthand
+C<+RoleName>. Note that role support depends on L<Role::Tiny> (2.000001+).
# Create a new class with the role "SubClass::Role::Foo" and instantiate it
my $new_class = SubClass->with_roles('+Foo');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment