This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
Sequenzia/Rails/ActionView/Helper/Methods/Inflections.php

55 lines
1.3 KiB
PHP
Raw Normal View History

2013-10-02 08:12:58 +02:00
<?php
namespace Rails\ActionView\Helper\Methods;
trait Inflections
{
public function pluralize($word, $locale = 'en')
{
return $this->inflector()->pluralize($word, $locale);
}
public function singularize($word, $locale = 'en')
{
return $this->inflector()->singularize($word, $locale);
}
public function camelize($term, $uppercaseFirstLetter = true)
{
return $this->inflector()->camelize($term, $uppercaseFirstLetter);
}
public function underscore($camelCasedWord)
{
return $this->inflector()->underscore($camelCasedWord);
}
public function humanize($lowerCaseAndUnderscoredWord)
{
return $this->inflector()->humanize($lowerCaseAndUnderscoredWord);
}
public function titleize($word)
{
return $this->inflector()->titleize($word);
}
public function tableize($className)
{
return $this->inflector()->tableize($className);
}
public function classify($tableName)
{
return $this->inflector()->classify($tableName);
}
public function ordinal($number)
{
return $this->inflector()->ordinal($number);
}
public function inflector()
{
return \Rails::services()->get('inflector');
}
}