motion_blender-support 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.yardopts +1 -0
  4. data/Gemfile +4 -0
  5. data/HACKS.md +7 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.md +359 -0
  8. data/Rakefile +14 -0
  9. data/app/app_delegate.rb +5 -0
  10. data/examples/Inflector/.gitignore +16 -0
  11. data/examples/Inflector/Gemfile +5 -0
  12. data/examples/Inflector/Rakefile +13 -0
  13. data/examples/Inflector/app/app_delegate.rb +8 -0
  14. data/examples/Inflector/app/inflections.rb +5 -0
  15. data/examples/Inflector/app/inflector_view_controller.rb +109 -0
  16. data/examples/Inflector/app/words_view_controller.rb +101 -0
  17. data/examples/Inflector/resources/Default-568h@2x.png +0 -0
  18. data/examples/Inflector/spec/main_spec.rb +9 -0
  19. data/lib/motion-support/callbacks.rb +8 -0
  20. data/lib/motion-support/concern.rb +4 -0
  21. data/lib/motion-support/core_ext/array.rb +10 -0
  22. data/lib/motion-support/core_ext/class.rb +5 -0
  23. data/lib/motion-support/core_ext/hash.rb +13 -0
  24. data/lib/motion-support/core_ext/integer.rb +6 -0
  25. data/lib/motion-support/core_ext/module.rb +11 -0
  26. data/lib/motion-support/core_ext/numeric.rb +6 -0
  27. data/lib/motion-support/core_ext/object.rb +12 -0
  28. data/lib/motion-support/core_ext/range.rb +5 -0
  29. data/lib/motion-support/core_ext/string.rb +13 -0
  30. data/lib/motion-support/core_ext/time.rb +16 -0
  31. data/lib/motion-support/core_ext.rb +13 -0
  32. data/lib/motion-support/inflector.rb +8 -0
  33. data/lib/motion-support.rb +81 -0
  34. data/motion/_stdlib/array.rb +13 -0
  35. data/motion/_stdlib/cgi.rb +22 -0
  36. data/motion/_stdlib/date.rb +81 -0
  37. data/motion/_stdlib/enumerable.rb +9 -0
  38. data/motion/_stdlib/time.rb +19 -0
  39. data/motion/callbacks.rb +511 -0
  40. data/motion/concern.rb +122 -0
  41. data/motion/core_ext/array/access.rb +28 -0
  42. data/motion/core_ext/array/conversions.rb +86 -0
  43. data/motion/core_ext/array/extract_options.rb +11 -0
  44. data/motion/core_ext/array/grouping.rb +99 -0
  45. data/motion/core_ext/array/prepend_and_append.rb +7 -0
  46. data/motion/core_ext/array/wrap.rb +45 -0
  47. data/motion/core_ext/array.rb +19 -0
  48. data/motion/core_ext/class/attribute.rb +119 -0
  49. data/motion/core_ext/class/attribute_accessors.rb +168 -0
  50. data/motion/core_ext/date/acts_like.rb +8 -0
  51. data/motion/core_ext/date/calculations.rb +117 -0
  52. data/motion/core_ext/date/conversions.rb +56 -0
  53. data/motion/core_ext/date_and_time/calculations.rb +232 -0
  54. data/motion/core_ext/enumerable.rb +90 -0
  55. data/motion/core_ext/hash/deep_delete_if.rb +23 -0
  56. data/motion/core_ext/hash/deep_merge.rb +27 -0
  57. data/motion/core_ext/hash/except.rb +15 -0
  58. data/motion/core_ext/hash/indifferent_access.rb +19 -0
  59. data/motion/core_ext/hash/keys.rb +150 -0
  60. data/motion/core_ext/hash/reverse_merge.rb +22 -0
  61. data/motion/core_ext/hash/slice.rb +40 -0
  62. data/motion/core_ext/integer/inflections.rb +27 -0
  63. data/motion/core_ext/integer/multiple.rb +10 -0
  64. data/motion/core_ext/integer/time.rb +41 -0
  65. data/motion/core_ext/kernel/singleton_class.rb +6 -0
  66. data/motion/core_ext/metaclass.rb +8 -0
  67. data/motion/core_ext/module/aliasing.rb +69 -0
  68. data/motion/core_ext/module/anonymous.rb +19 -0
  69. data/motion/core_ext/module/attr_internal.rb +38 -0
  70. data/motion/core_ext/module/attribute_accessors.rb +64 -0
  71. data/motion/core_ext/module/delegation.rb +175 -0
  72. data/motion/core_ext/module/introspection.rb +60 -0
  73. data/motion/core_ext/module/reachable.rb +5 -0
  74. data/motion/core_ext/module/remove_method.rb +12 -0
  75. data/motion/core_ext/ns_dictionary.rb +14 -0
  76. data/motion/core_ext/ns_string.rb +14 -0
  77. data/motion/core_ext/numeric/bytes.rb +44 -0
  78. data/motion/core_ext/numeric/conversions.rb +49 -0
  79. data/motion/core_ext/numeric/time.rb +75 -0
  80. data/motion/core_ext/object/acts_like.rb +10 -0
  81. data/motion/core_ext/object/blank.rb +105 -0
  82. data/motion/core_ext/object/deep_dup.rb +44 -0
  83. data/motion/core_ext/object/duplicable.rb +87 -0
  84. data/motion/core_ext/object/inclusion.rb +15 -0
  85. data/motion/core_ext/object/instance_variables.rb +28 -0
  86. data/motion/core_ext/object/to_param.rb +58 -0
  87. data/motion/core_ext/object/to_query.rb +26 -0
  88. data/motion/core_ext/object/try.rb +78 -0
  89. data/motion/core_ext/range/include_range.rb +23 -0
  90. data/motion/core_ext/range/overlaps.rb +8 -0
  91. data/motion/core_ext/regexp.rb +5 -0
  92. data/motion/core_ext/string/access.rb +104 -0
  93. data/motion/core_ext/string/behavior.rb +6 -0
  94. data/motion/core_ext/string/exclude.rb +11 -0
  95. data/motion/core_ext/string/filters.rb +55 -0
  96. data/motion/core_ext/string/indent.rb +43 -0
  97. data/motion/core_ext/string/inflections.rb +178 -0
  98. data/motion/core_ext/string/starts_ends_with.rb +4 -0
  99. data/motion/core_ext/string/strip.rb +24 -0
  100. data/motion/core_ext/time/acts_like.rb +8 -0
  101. data/motion/core_ext/time/calculations.rb +215 -0
  102. data/motion/core_ext/time/conversions.rb +52 -0
  103. data/motion/descendants_tracker.rb +50 -0
  104. data/motion/duration.rb +104 -0
  105. data/motion/hash_with_indifferent_access.rb +253 -0
  106. data/motion/inflections.rb +67 -0
  107. data/motion/inflector/inflections.rb +203 -0
  108. data/motion/inflector/methods.rb +321 -0
  109. data/motion/logger.rb +47 -0
  110. data/motion/number_helper.rb +54 -0
  111. data/motion/version.rb +3 -0
  112. data/motion_blender-support.gemspec +21 -0
  113. data/spec/motion-support/_helpers/constantize_test_cases.rb +75 -0
  114. data/spec/motion-support/_helpers/inflector_test_cases.rb +270 -0
  115. data/spec/motion-support/callback_spec.rb +702 -0
  116. data/spec/motion-support/concern_spec.rb +93 -0
  117. data/spec/motion-support/core_ext/array/access_spec.rb +29 -0
  118. data/spec/motion-support/core_ext/array/conversion_spec.rb +60 -0
  119. data/spec/motion-support/core_ext/array/extract_options_spec.rb +15 -0
  120. data/spec/motion-support/core_ext/array/grouping_spec.rb +85 -0
  121. data/spec/motion-support/core_ext/array/prepend_and_append_spec.rb +25 -0
  122. data/spec/motion-support/core_ext/array/wrap_spec.rb +19 -0
  123. data/spec/motion-support/core_ext/array_spec.rb +16 -0
  124. data/spec/motion-support/core_ext/class/attribute_accessor_spec.rb +127 -0
  125. data/spec/motion-support/core_ext/class/attribute_spec.rb +92 -0
  126. data/spec/motion-support/core_ext/date/acts_like_spec.rb +11 -0
  127. data/spec/motion-support/core_ext/date/calculation_spec.rb +186 -0
  128. data/spec/motion-support/core_ext/date/conversion_spec.rb +18 -0
  129. data/spec/motion-support/core_ext/date_and_time/calculation_spec.rb +336 -0
  130. data/spec/motion-support/core_ext/enumerable_spec.rb +130 -0
  131. data/spec/motion-support/core_ext/hash/deep_delete_if_spec.rb +19 -0
  132. data/spec/motion-support/core_ext/hash/deep_merge_spec.rb +32 -0
  133. data/spec/motion-support/core_ext/hash/except_spec.rb +43 -0
  134. data/spec/motion-support/core_ext/hash/key_spec.rb +236 -0
  135. data/spec/motion-support/core_ext/hash/reverse_merge_spec.rb +26 -0
  136. data/spec/motion-support/core_ext/hash/slice_spec.rb +61 -0
  137. data/spec/motion-support/core_ext/integer/inflection_spec.rb +23 -0
  138. data/spec/motion-support/core_ext/integer/multiple_spec.rb +19 -0
  139. data/spec/motion-support/core_ext/kernel/singleton_class_spec.rb +9 -0
  140. data/spec/motion-support/core_ext/metaclass_spec.rb +9 -0
  141. data/spec/motion-support/core_ext/module/aliasing_spec.rb +143 -0
  142. data/spec/motion-support/core_ext/module/anonymous_spec.rb +29 -0
  143. data/spec/motion-support/core_ext/module/attr_internal_spec.rb +104 -0
  144. data/spec/motion-support/core_ext/module/attribute_accessor_spec.rb +86 -0
  145. data/spec/motion-support/core_ext/module/delegation_spec.rb +136 -0
  146. data/spec/motion-support/core_ext/module/introspection_spec.rb +70 -0
  147. data/spec/motion-support/core_ext/module/reachable_spec.rb +61 -0
  148. data/spec/motion-support/core_ext/module/remove_method_spec.rb +25 -0
  149. data/spec/motion-support/core_ext/numeric/bytes_spec.rb +43 -0
  150. data/spec/motion-support/core_ext/numeric/conversions_spec.rb +40 -0
  151. data/spec/motion-support/core_ext/object/acts_like_spec.rb +21 -0
  152. data/spec/motion-support/core_ext/object/blank_spec.rb +54 -0
  153. data/spec/motion-support/core_ext/object/deep_dup_spec.rb +54 -0
  154. data/spec/motion-support/core_ext/object/duplicable_spec.rb +31 -0
  155. data/spec/motion-support/core_ext/object/inclusion_spec.rb +34 -0
  156. data/spec/motion-support/core_ext/object/instance_variable_spec.rb +19 -0
  157. data/spec/motion-support/core_ext/object/to_param_spec.rb +75 -0
  158. data/spec/motion-support/core_ext/object/to_query_spec.rb +37 -0
  159. data/spec/motion-support/core_ext/object/try_spec.rb +92 -0
  160. data/spec/motion-support/core_ext/range/include_range_spec.rb +31 -0
  161. data/spec/motion-support/core_ext/range/overlap_spec.rb +43 -0
  162. data/spec/motion-support/core_ext/regexp_spec.rb +7 -0
  163. data/spec/motion-support/core_ext/string/access_spec.rb +53 -0
  164. data/spec/motion-support/core_ext/string/behavior_spec.rb +7 -0
  165. data/spec/motion-support/core_ext/string/exclude_spec.rb +8 -0
  166. data/spec/motion-support/core_ext/string/filter_spec.rb +49 -0
  167. data/spec/motion-support/core_ext/string/indent_spec.rb +56 -0
  168. data/spec/motion-support/core_ext/string/inflection_spec.rb +142 -0
  169. data/spec/motion-support/core_ext/string/starts_end_with_spec.rb +14 -0
  170. data/spec/motion-support/core_ext/string/strip_spec.rb +34 -0
  171. data/spec/motion-support/core_ext/string_spec.rb +88 -0
  172. data/spec/motion-support/core_ext/time/acts_like_spec.rb +11 -0
  173. data/spec/motion-support/core_ext/time/calculation_spec.rb +201 -0
  174. data/spec/motion-support/core_ext/time/conversion_spec.rb +53 -0
  175. data/spec/motion-support/descendants_tracker_spec.rb +58 -0
  176. data/spec/motion-support/duration_spec.rb +107 -0
  177. data/spec/motion-support/hash_with_indifferent_access_spec.rb +605 -0
  178. data/spec/motion-support/inflector_spec.rb +504 -0
  179. data/spec/motion-support/ns_dictionary_spec.rb +89 -0
  180. data/spec/motion-support/ns_string_spec.rb +182 -0
  181. data/spec/motion-support/number_helper_spec.rb +55 -0
  182. metadata +352 -0
@@ -0,0 +1,270 @@
1
+ module InflectorTestCases
2
+ SingularToPlural = {
3
+ "search" => "searches",
4
+ "switch" => "switches",
5
+ "fix" => "fixes",
6
+ "box" => "boxes",
7
+ "process" => "processes",
8
+ "address" => "addresses",
9
+ "case" => "cases",
10
+ "stack" => "stacks",
11
+ "wish" => "wishes",
12
+ "fish" => "fish",
13
+ "jeans" => "jeans",
14
+ "funky jeans" => "funky jeans",
15
+ "my money" => "my money",
16
+
17
+ "category" => "categories",
18
+ "query" => "queries",
19
+ "ability" => "abilities",
20
+ "agency" => "agencies",
21
+ "movie" => "movies",
22
+
23
+ "archive" => "archives",
24
+
25
+ "index" => "indices",
26
+
27
+ "wife" => "wives",
28
+ "safe" => "saves",
29
+ "half" => "halves",
30
+
31
+ "move" => "moves",
32
+
33
+ "salesperson" => "salespeople",
34
+ "person" => "people",
35
+
36
+ "spokesman" => "spokesmen",
37
+ "man" => "men",
38
+ "woman" => "women",
39
+
40
+ "basis" => "bases",
41
+ "diagnosis" => "diagnoses",
42
+ "diagnosis_a" => "diagnosis_as",
43
+
44
+ "datum" => "data",
45
+ "medium" => "media",
46
+ "stadium" => "stadia",
47
+ "analysis" => "analyses",
48
+ "my_analysis" => "my_analyses",
49
+
50
+ "node_child" => "node_children",
51
+ "child" => "children",
52
+
53
+ "experience" => "experiences",
54
+ "day" => "days",
55
+
56
+ "comment" => "comments",
57
+ "foobar" => "foobars",
58
+ "newsletter" => "newsletters",
59
+
60
+ "old_news" => "old_news",
61
+ "news" => "news",
62
+
63
+ "series" => "series",
64
+ "species" => "species",
65
+
66
+ "quiz" => "quizzes",
67
+
68
+ "perspective" => "perspectives",
69
+
70
+ "ox" => "oxen",
71
+ "photo" => "photos",
72
+ "buffalo" => "buffaloes",
73
+ "tomato" => "tomatoes",
74
+ "dwarf" => "dwarves",
75
+ "elf" => "elves",
76
+ "information" => "information",
77
+ "equipment" => "equipment",
78
+ "bus" => "buses",
79
+ "status" => "statuses",
80
+ "status_code" => "status_codes",
81
+ "mouse" => "mice",
82
+
83
+ "louse" => "lice",
84
+ "house" => "houses",
85
+ "octopus" => "octopi",
86
+ "virus" => "viri",
87
+ "alias" => "aliases",
88
+ "portfolio" => "portfolios",
89
+
90
+ "vertex" => "vertices",
91
+ "matrix" => "matrices",
92
+ "matrix_fu" => "matrix_fus",
93
+
94
+ "axis" => "axes",
95
+ "taxi" => "taxis", # prevents regression
96
+ "testis" => "testes",
97
+ "crisis" => "crises",
98
+
99
+ "rice" => "rice",
100
+ "shoe" => "shoes",
101
+
102
+ "horse" => "horses",
103
+ "prize" => "prizes",
104
+ "edge" => "edges",
105
+
106
+ "cow" => "kine",
107
+ "database" => "databases",
108
+
109
+ # regression tests against improper inflection regexes
110
+ "|ice" => "|ices",
111
+ "|ouse" => "|ouses",
112
+ "slice" => "slices",
113
+ "police" => "police"
114
+ }
115
+
116
+ CamelToUnderscore = {
117
+ "Product" => "product",
118
+ "SpecialGuest" => "special_guest",
119
+ "ApplicationController" => "application_controller",
120
+ "Area51Controller" => "area51_controller"
121
+ }
122
+
123
+ UnderscoreToLowerCamel = {
124
+ "product" => "product",
125
+ "special_guest" => "specialGuest",
126
+ "application_controller" => "applicationController",
127
+ "area51_controller" => "area51Controller"
128
+ }
129
+
130
+ SymbolToLowerCamel = {
131
+ :product => 'product',
132
+ :special_guest => 'specialGuest',
133
+ :application_controller => 'applicationController',
134
+ :area51_controller => 'area51Controller'
135
+ }
136
+
137
+ CamelToUnderscoreWithoutReverse = {
138
+ "HTMLTidy" => "html_tidy",
139
+ "HTMLTidyGenerator" => "html_tidy_generator",
140
+ "FreeBSD" => "free_bsd",
141
+ "HTML" => "html",
142
+ }
143
+
144
+ CamelWithModuleToUnderscoreWithSlash = {
145
+ "Admin::Product" => "admin/product",
146
+ "Users::Commission::Department" => "users/commission/department",
147
+ "UsersSection::CommissionDepartment" => "users_section/commission_department",
148
+ }
149
+
150
+ ClassNameToForeignKeyWithUnderscore = {
151
+ "Person" => "person_id",
152
+ "MyApplication::Billing::Account" => "account_id"
153
+ }
154
+
155
+ ClassNameToForeignKeyWithoutUnderscore = {
156
+ "Person" => "personid",
157
+ "MyApplication::Billing::Account" => "accountid"
158
+ }
159
+
160
+ ClassNameToTableName = {
161
+ "PrimarySpokesman" => "primary_spokesmen",
162
+ "NodeChild" => "node_children"
163
+ }
164
+
165
+ UnderscoreToHuman = {
166
+ "employee_salary" => "Employee salary",
167
+ "employee_id" => "Employee",
168
+ "underground" => "Underground"
169
+ }
170
+
171
+ MixtureToTitleCase = {
172
+ 'active_record' => 'Active Record',
173
+ 'ActiveRecord' => 'Active Record',
174
+ 'action web service' => 'Action Web Service',
175
+ 'Action Web Service' => 'Action Web Service',
176
+ 'Action web service' => 'Action Web Service',
177
+ 'actionwebservice' => 'Actionwebservice',
178
+ 'Actionwebservice' => 'Actionwebservice',
179
+ "david's code" => "David's Code",
180
+ "David's code" => "David's Code",
181
+ "david's Code" => "David's Code",
182
+ "sgt. pepper's" => "Sgt. Pepper's",
183
+ "i've just seen a face" => "I've Just Seen A Face",
184
+ "maybe you'll be there" => "Maybe You'll Be There",
185
+ "¿por qué?" => '¿Por Qué?',
186
+ "Fred’s" => "Fred’s",
187
+ "Fred`s" => "Fred`s"
188
+ }
189
+
190
+ OrdinalNumbers = {
191
+ "-1" => "-1st",
192
+ "-2" => "-2nd",
193
+ "-3" => "-3rd",
194
+ "-4" => "-4th",
195
+ "-5" => "-5th",
196
+ "-6" => "-6th",
197
+ "-7" => "-7th",
198
+ "-8" => "-8th",
199
+ "-9" => "-9th",
200
+ "-10" => "-10th",
201
+ "-11" => "-11th",
202
+ "-12" => "-12th",
203
+ "-13" => "-13th",
204
+ "-14" => "-14th",
205
+ "-20" => "-20th",
206
+ "-21" => "-21st",
207
+ "-22" => "-22nd",
208
+ "-23" => "-23rd",
209
+ "-24" => "-24th",
210
+ "-100" => "-100th",
211
+ "-101" => "-101st",
212
+ "-102" => "-102nd",
213
+ "-103" => "-103rd",
214
+ "-104" => "-104th",
215
+ "-110" => "-110th",
216
+ "-111" => "-111th",
217
+ "-112" => "-112th",
218
+ "-113" => "-113th",
219
+ "-1000" => "-1000th",
220
+ "-1001" => "-1001st",
221
+ "0" => "0th",
222
+ "1" => "1st",
223
+ "2" => "2nd",
224
+ "3" => "3rd",
225
+ "4" => "4th",
226
+ "5" => "5th",
227
+ "6" => "6th",
228
+ "7" => "7th",
229
+ "8" => "8th",
230
+ "9" => "9th",
231
+ "10" => "10th",
232
+ "11" => "11th",
233
+ "12" => "12th",
234
+ "13" => "13th",
235
+ "14" => "14th",
236
+ "20" => "20th",
237
+ "21" => "21st",
238
+ "22" => "22nd",
239
+ "23" => "23rd",
240
+ "24" => "24th",
241
+ "100" => "100th",
242
+ "101" => "101st",
243
+ "102" => "102nd",
244
+ "103" => "103rd",
245
+ "104" => "104th",
246
+ "110" => "110th",
247
+ "111" => "111th",
248
+ "112" => "112th",
249
+ "113" => "113th",
250
+ "1000" => "1000th",
251
+ "1001" => "1001st"
252
+ }
253
+
254
+ UnderscoresToDashes = {
255
+ "street" => "street",
256
+ "street_address" => "street-address",
257
+ "person_street_address" => "person-street-address"
258
+ }
259
+
260
+ Irregularities = {
261
+ 'person' => 'people',
262
+ 'man' => 'men',
263
+ 'child' => 'children',
264
+ 'sex' => 'sexes',
265
+ 'move' => 'moves',
266
+ 'cow' => 'kine',
267
+ 'zombie' => 'zombies',
268
+ 'genus' => 'genera'
269
+ }
270
+ end