Skip to content

Commit

Permalink
better description for camelization
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 8, 2015
1 parent ab8be9b commit b5bd406
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/Util.pm
Expand Up @@ -471,7 +471,7 @@ Base64 encode bytes, the line ending defaults to a newline.
my $camelcase = camelize $snakecase;
Convert snake_case string to CamelCase and replace C<-> with C<::>.
Convert C<snake_case> string to C<CamelCase> and replace C<-> with C<::>.
# "FooBar"
camelize 'foo_bar';
Expand Down Expand Up @@ -516,7 +516,7 @@ Convert class name to path.
my $snakecase = decamelize $camelcase;
Convert CamelCase string to snake_case and replace C<::> with C<->.
Convert C<CamelCase> string to C<snake_case> and replace C<::> with C<->.
# "foo_bar"
decamelize 'FooBar';
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -32,8 +32,8 @@ C<handler> to C<ep>.
{template => 'foo', format => 'txt'} -> 'foo.txt.ep'
{template => 'foo', handler => 'epl'} -> 'foo.html.epl'

The C<controller> value gets decamelized using L<Mojo::Util/"decamelize"> and
C<-> characters replaced with C</>.
The C<controller> value gets converted from C<CamelCase> to C<snake_case>
using L<Mojo::Util/"decamelize"> and C<-> characters replaced with C</>.

{controller => 'My::Users', action => 'add'} -> 'my/users/add.html.ep'
{controller => 'my-users', action => 'show'} -> 'my/users/show.html.ep'
Expand Down
11 changes: 6 additions & 5 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -293,11 +293,12 @@ old ones.

When the dispatcher sees C<controller> and C<action> values in the stash it
will always try to turn them into a class and method to dispatch to. The
C<controller> value gets camelized using L<Mojo::Util/"camelize"> and
appended to one or more namespaces, defaulting to a controller namespace based
on the application class (C<MyApp::Controller>), as well as the bare
application class (C<MyApp>), and these namespaces are searched in that order.
The action value is not changed at all, so both values are case sensitive.
C<controller> value gets converted from C<snake_case> to C<CamelCase> using
L<Mojo::Util/"camelize"> and appended to one or more namespaces, defaulting to
a controller namespace based on the application class (C<MyApp::Controller>),
as well as the bare application class (C<MyApp>), and these namespaces are
searched in that order. The action value is not changed at all, so both values
are case sensitive.

# Application
package MyApp;
Expand Down

0 comments on commit b5bd406

Please sign in to comment.