3 module InflectorTestCases
5 "search" => "searches",
6 "switch" => "switches",
9 "process" => "processes",
10 "address" => "addresses",
16 "category" => "categories",
18 "ability" => "abilities",
19 "agency" => "agencies",
22 "archive" => "archives",
32 "salesperson" => "salespeople",
35 "spokesman" => "spokesmen",
40 "diagnosis" => "diagnoses",
41 "diagnosis_a" => "diagnosis_as",
45 "analysis" => "analyses",
47 "node_child" => "node_children",
48 "child" => "children",
50 "experience" => "experiences",
53 "comment" => "comments",
54 "foobar" => "foobars",
55 "newsletter" => "newsletters",
57 "old_news" => "old_news",
61 "species" => "species",
65 "perspective" => "perspectives",
69 "buffalo" => "buffaloes",
70 "tomato" => "tomatoes",
73 "information" => "information",
74 "equipment" => "equipment",
76 "status" => "statuses",
77 "status_code" => "status_codes",
82 "octopus" => "octopi",
85 "portfolio" => "portfolios",
87 "vertex" => "vertices",
88 "matrix" => "matrices",
89 "matrix_fu" => "matrix_fus",
103 "database" => "databases"
106 CamelToUnderscore = {
107 "Product" => "product",
108 "SpecialGuest" => "special_guest",
109 "ApplicationController" => "application_controller",
110 "Area51Controller" => "area51_controller"
113 UnderscoreToLowerCamel = {
114 "product" => "product",
115 "special_guest" => "specialGuest",
116 "application_controller" => "applicationController",
117 "area51_controller" => "area51Controller"
120 CamelToUnderscoreWithoutReverse = {
121 "HTMLTidy" => "html_tidy",
122 "HTMLTidyGenerator" => "html_tidy_generator",
123 "FreeBSD" => "free_bsd",
127 CamelWithModuleToUnderscoreWithSlash = {
128 "Admin::Product" => "admin/product",
129 "Users::Commission::Department" => "users/commission/department",
130 "UsersSection::CommissionDepartment" => "users_section/commission_department",
133 ClassNameToForeignKeyWithUnderscore = {
134 "Person" => "person_id",
135 "MyApplication::Billing::Account" => "account_id"
138 ClassNameToForeignKeyWithoutUnderscore = {
139 "Person" => "personid",
140 "MyApplication::Billing::Account" => "accountid"
143 ClassNameToTableName = {
144 "PrimarySpokesman" => "primary_spokesmen",
145 "NodeChild" => "node_children"
148 StringToParameterized = {
149 "Donald E. Knuth" => "donald-e-knuth",
150 "Random text with *(bad)* characters" => "random-text-with-bad-characters",
151 "Allow_Under_Scores" => "allow_under_scores",
152 "Trailing bad characters!@#" => "trailing-bad-characters",
153 "!@#Leading bad characters" => "leading-bad-characters",
154 "Squeeze separators" => "squeeze-separators"
157 StringToParameterizeWithNoSeparator = {
158 "Donald E. Knuth" => "donaldeknuth",
159 "Random text with *(bad)* characters" => "randomtextwithbadcharacters",
160 "Trailing bad characters!@#" => "trailingbadcharacters",
161 "!@#Leading bad characters" => "leadingbadcharacters",
162 "Squeeze separators" => "squeezeseparators"
165 StringToParameterizeWithUnderscore = {
166 "Donald E. Knuth" => "donald_e_knuth",
167 "Random text with *(bad)* characters" => "random_text_with_bad_characters",
168 "Trailing bad characters!@#" => "trailing_bad_characters",
169 "!@#Leading bad characters" => "leading_bad_characters",
170 "Squeeze separators" => "squeeze_separators"
173 # Ruby 1.9 doesn't do Unicode normalization yet.
174 if RUBY_VERSION >= '1.9'
175 StringToParameterizedAndNormalized = {
177 "Garçons" => "gar-ons"
180 StringToParameterizedAndNormalized = {
182 "Garçons" => "garcons"
186 UnderscoreToHuman = {
187 "employee_salary" => "Employee salary",
188 "employee_id" => "Employee",
189 "underground" => "Underground"
192 MixtureToTitleCase = {
193 'active_record' => 'Active Record',
194 'ActiveRecord' => 'Active Record',
195 'action web service' => 'Action Web Service',
196 'Action Web Service' => 'Action Web Service',
197 'Action web service' => 'Action Web Service',
198 'actionwebservice' => 'Actionwebservice',
199 'Actionwebservice' => 'Actionwebservice',
200 "david's code" => "David's Code",
201 "David's code" => "David's Code",
202 "david's Code" => "David's Code"
239 UnderscoresToDashes = {
240 "street" => "street",
241 "street_address" => "street-address",
242 "person_street_address" => "person-street-address"
246 'person' => 'people',
248 'child' => 'children',