NAME

Valiant::Naming - Standard naming information for your models

SYNOPSIS

$model->model_name->human;
$model->model_name->singular;
$model->model_name->plural;
$model->model_name->param_key;

DESCRIPTION

Exposes a method on your models called model_name which returns an instance of Valiant::Name. This object contains various attributes used for creating a standard approach to naming or referencing your object.

If your object defines a method i18n_scope that will be used as the base namespace part to lookup your objects naming information from a set of defined translations.

METHODS

This component adds the following methods to your result classes.

model_name

An instance of Valiant::Name. This object exposes the following attributes:

human

A human readable name for your object. This will either be inferred from the package name of the object or if i18n_scope is defined will be looked up in translations.

You can get the pluralized version of this name by passing a count argument greater than 1. Example:

$model->model_name->human(count=>2); # returns 'People'

singular

plural

Your model name in singular or plural form.

param_key

A name for your object that is suitable for serialization such as in an HTML form or other serialization formats.

AUTHOR

John Napiorkowski email:jjnapiork@cpan.org

SEE ALSO

Valiant

COPYRIGHT & LICENSE

Copyright 2020, John Napiorkowski email:jjnapiork@cpan.org

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.