handlebars-helpers 0.0.5 → 0.0.65

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +3 -3
  3. data/.gitignore +1 -0
  4. data/.handlebars_helpers.json +901 -0
  5. data/.handlebars_string_formatters.json +137 -0
  6. data/.rubocop.yml +4 -2
  7. data/.vscode/settings.json +6 -0
  8. data/Gemfile +3 -0
  9. data/Rakefile +1 -0
  10. data/STORIES.md +44 -6
  11. data/handlebars-helpers.gemspec +2 -0
  12. data/lib/handlebars/helpers.rb +2 -0
  13. data/lib/handlebars/helpers/base_helper.rb +36 -0
  14. data/lib/handlebars/helpers/base_safe_string_helper.rb +17 -0
  15. data/lib/handlebars/helpers/code_ruby/classify.rb +40 -0
  16. data/lib/handlebars/helpers/code_ruby/deconstantize.rb +48 -0
  17. data/lib/handlebars/helpers/code_ruby/demodulize.rb +58 -0
  18. data/lib/handlebars/helpers/code_ruby/foreign_key.rb +49 -0
  19. data/lib/handlebars/helpers/code_ruby/tableize.rb +35 -0
  20. data/lib/handlebars/helpers/comparison/and.rb +44 -0
  21. data/lib/handlebars/helpers/comparison/default.rb +66 -0
  22. data/lib/handlebars/helpers/comparison/eq.rb +35 -0
  23. data/lib/handlebars/helpers/comparison/gt.rb +35 -0
  24. data/lib/handlebars/helpers/comparison/gte.rb +43 -0
  25. data/lib/handlebars/helpers/comparison/lt.rb +35 -0
  26. data/lib/handlebars/helpers/comparison/lte.rb +43 -0
  27. data/lib/handlebars/helpers/comparison/ne.rb +35 -0
  28. data/lib/handlebars/helpers/comparison/or.rb +56 -0
  29. data/lib/handlebars/helpers/configuration.rb +72 -0
  30. data/lib/handlebars/helpers/inflection/ordinal.rb +58 -0
  31. data/lib/handlebars/helpers/inflection/ordinalize.rb +59 -0
  32. data/lib/handlebars/helpers/inflection/pluralize.rb +36 -0
  33. data/lib/handlebars/helpers/inflection/pluralize_by_number.rb +60 -0
  34. data/lib/handlebars/helpers/inflection/singularize.rb +35 -0
  35. data/lib/handlebars/helpers/register_helpers.rb +73 -0
  36. data/lib/handlebars/helpers/string_formatting/append_if.rb +42 -0
  37. data/lib/handlebars/helpers/string_formatting/back_slash.rb +33 -0
  38. data/lib/handlebars/helpers/string_formatting/camel.rb +29 -0
  39. data/lib/handlebars/helpers/string_formatting/constantize.rb +29 -0
  40. data/lib/handlebars/helpers/string_formatting/dasherize.rb +33 -0
  41. data/lib/handlebars/helpers/string_formatting/dotirize.rb +33 -0
  42. data/lib/handlebars/helpers/string_formatting/double_colon.rb +33 -0
  43. data/lib/handlebars/helpers/string_formatting/downcase.rb +31 -0
  44. data/lib/handlebars/helpers/string_formatting/format_as.rb +57 -0
  45. data/lib/handlebars/helpers/string_formatting/humanize.rb +39 -0
  46. data/lib/handlebars/helpers/string_formatting/lamel.rb +29 -0
  47. data/lib/handlebars/helpers/string_formatting/padl.rb +58 -0
  48. data/lib/handlebars/helpers/string_formatting/padr.rb +59 -0
  49. data/lib/handlebars/helpers/string_formatting/pluserize.rb +29 -0
  50. data/lib/handlebars/helpers/string_formatting/prepend_if.rb +42 -0
  51. data/lib/handlebars/helpers/string_formatting/singularize.rb +35 -0
  52. data/lib/handlebars/helpers/string_formatting/slash.rb +33 -0
  53. data/lib/handlebars/helpers/string_formatting/snake.rb +33 -0
  54. data/lib/handlebars/helpers/string_formatting/string.js +511 -0
  55. data/lib/handlebars/helpers/string_formatting/surround.rb +49 -0
  56. data/lib/handlebars/helpers/string_formatting/surround_if.rb +43 -0
  57. data/lib/handlebars/helpers/string_formatting/titleize.rb +39 -0
  58. data/lib/handlebars/helpers/string_formatting/upcase.rb +31 -0
  59. data/lib/handlebars/helpers/string_tokenizer.rb +43 -0
  60. data/lib/handlebars/helpers/template.rb +68 -0
  61. data/lib/handlebars/helpers/version.rb +1 -1
  62. metadata +82 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57de8a5236ee35ac1688c825dce948981ac27f09c34fb85bbf9ad50df818bba1
4
- data.tar.gz: efe57a3018a4e9a450337f2532892baef6ee9d042c28ed9ea2745720e46aebc5
3
+ metadata.gz: c662284c8c52e28de8f381e5dd2c4ee11bedee4034a2b701c0838075a7cead98
4
+ data.tar.gz: 1af1502591258fefec9225591ad2bbbc1b7521d67ca17f777626a845f91328b4
5
5
  SHA512:
6
- metadata.gz: 3ac2cf2f9bc9987d392bb26f515d81a0d999eb33c687bc3f7126a705d7e26674aa977ef7333cb6f42f095e7b7f3cc8cb24326c64a5785f58073f33a1252a29b6
7
- data.tar.gz: e8c51c96551e12329b75ac0a0a00902060322b1aeeb96d76b4cf1878cd229aff789a5a2f99e126b3a0107fce0f6beb6ed76427f6ebad94581187e3bc77319aef
6
+ metadata.gz: 30ba4275b1b9d8e7e9081ee45fd030b3dc0722e2800fcd6bbe75e855ee8d48345965fdd221b84b849acca670b89b2ad9abeaef1b47ba7f2bf65a5883624f012d
7
+ data.tar.gz: 1a0a23d9573b925dc90f5defc122151870bf76504bc242807784509bc2219efb4f15d8c41868788926ca722a025fceec303b1e36ad6d6f946ee24d9b1bd2cb5b
@@ -1,6 +1,5 @@
1
1
  # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
2
2
  # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
3
-
4
3
  name: Ruby
5
4
 
6
5
  on:
@@ -19,10 +18,11 @@ jobs:
19
18
  - name: Set up Ruby
20
19
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
21
20
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
22
- # uses: ruby/setup-ruby@v1
23
- uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
21
+ uses: ruby/setup-ruby@v1
22
+ # uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
24
23
  with:
25
24
  ruby-version: 2.6
25
+ # bundler-cache: true # runs 'bundle install' and caches installed gems automatically
26
26
  - name: Install dependencies
27
27
  run: bundle install
28
28
  - name: Run tests
data/.gitignore CHANGED
@@ -29,6 +29,7 @@ handlebars_helpers.yml
29
29
  *.so
30
30
  *.o
31
31
  *.a
32
+ *.gem
32
33
  mkmf.log
33
34
 
34
35
  # Ruby Version
@@ -0,0 +1,901 @@
1
+ {
2
+ "groups": [
3
+ {
4
+ "active": true,
5
+ "name": "comparison",
6
+ "base_require": "handlebars/helpers/comparison",
7
+ "base_namespace": "Handlebars::Helpers::Comparison",
8
+ "description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.",
9
+ "examples": [
10
+ "https://github.com/helpers/handlebars-helpers/blob/master/lib/comparison.js",
11
+ "https://github.com/helpers/handlebars-helpers/blob/master/test/comparison.js"
12
+ ],
13
+ "helpers": [
14
+ {
15
+ "name": "default",
16
+ "description": "return value or default value",
17
+ "test_in": null,
18
+ "test_out": null,
19
+ "tests": [
20
+ {
21
+ "alias": "default",
22
+ "expected_value": "hello world",
23
+ "params": [
24
+ { "name": "p1", "value": null },
25
+ { "name": "p2", "value": null }
26
+ ],
27
+ "template": "{{default p1 p2 \"hello world\"}}"
28
+ }
29
+ ],
30
+ "aliases": ["default"],
31
+ "require_path": "handlebars/helpers/comparison/default",
32
+ "class_namespace": "Handlebars::Helpers::Comparison::Default",
33
+ "is_string_formatter": null
34
+ },
35
+ {
36
+ "name": "or",
37
+ "description": "return block when first value is truthy",
38
+ "test_in": null,
39
+ "test_out": null,
40
+ "tests": [
41
+ {
42
+ "alias": "or",
43
+ "expected_value": "param2",
44
+ "params": [
45
+ { "name": "p1", "value": null },
46
+ { "name": "p2", "value": "param2" }
47
+ ],
48
+ "template": "\n {{~#if (or p1 p2)~}}\n {{p1}}{{p2}}\n {{~/if~}}\n "
49
+ },
50
+ {
51
+ "alias": "any",
52
+ "expected_value": "param2",
53
+ "params": [
54
+ { "name": "p1", "value": null },
55
+ { "name": "p2", "value": "param2" }
56
+ ],
57
+ "template": "\n {{~#if (any p1 p2)~}}\n {{p1}}{{p2}}\n {{~/if~}}\n "
58
+ }
59
+ ],
60
+ "aliases": ["or", "any"],
61
+ "require_path": "handlebars/helpers/comparison/or",
62
+ "class_namespace": "Handlebars::Helpers::Comparison::Or",
63
+ "is_string_formatter": null
64
+ },
65
+ {
66
+ "name": "and",
67
+ "description": "return block when first value is truthy",
68
+ "test_in": null,
69
+ "test_out": null,
70
+ "tests": [
71
+ {
72
+ "alias": "and",
73
+ "expected_value": "all params exist",
74
+ "params": [
75
+ { "name": "p1", "value": "param1" },
76
+ { "name": "p2", "value": "param2" }
77
+ ],
78
+ "template": "\n {{~#if (and p1 p2)~}}\n all params exist\n {{~/if~}}\n "
79
+ },
80
+ {
81
+ "alias": "all",
82
+ "expected_value": "all params exist",
83
+ "params": [
84
+ { "name": "p1", "value": "param1" },
85
+ { "name": "p2", "value": "param2" }
86
+ ],
87
+ "template": "\n {{~#if (all p1 p2)~}}\n all params exist\n {{~/if~}}\n "
88
+ }
89
+ ],
90
+ "aliases": ["and", "all"],
91
+ "require_path": "handlebars/helpers/comparison/and",
92
+ "class_namespace": "Handlebars::Helpers::Comparison::And",
93
+ "is_string_formatter": null
94
+ },
95
+ {
96
+ "name": "eq",
97
+ "description": "return block when two values are equal",
98
+ "test_in": null,
99
+ "test_out": null,
100
+ "tests": [
101
+ {
102
+ "alias": "eq",
103
+ "expected_value": "params are equal",
104
+ "params": [
105
+ { "name": "p1", "value": "david" },
106
+ { "name": "p2", "value": "david" }
107
+ ],
108
+ "template": "\n {{~#if (eq p1 p2)~}}\n params are equal\n {{~/if~}}\n "
109
+ },
110
+ {
111
+ "alias": "equal",
112
+ "expected_value": "params are equal",
113
+ "params": [
114
+ { "name": "p1", "value": "david" },
115
+ { "name": "p2", "value": "david" }
116
+ ],
117
+ "template": "\n {{~#if (equal p1 p2)~}}\n params are equal\n {{~/if~}}\n "
118
+ }
119
+ ],
120
+ "aliases": ["eq", "equal"],
121
+ "require_path": "handlebars/helpers/comparison/eq",
122
+ "class_namespace": "Handlebars::Helpers::Comparison::Eq",
123
+ "is_string_formatter": null
124
+ },
125
+ {
126
+ "name": "ne",
127
+ "description": "return block when two values are NOT equal",
128
+ "test_in": null,
129
+ "test_out": null,
130
+ "tests": [
131
+ {
132
+ "alias": "ne",
133
+ "expected_value": "params are not equal",
134
+ "params": [
135
+ { "name": "p1", "value": "aaa" },
136
+ { "name": "p2", "value": "bbb" }
137
+ ],
138
+ "template": "\n {{~#if (ne p1 p2)~}}\n params are not equal\n {{~/if~}}\n "
139
+ },
140
+ {
141
+ "alias": "not_equal",
142
+ "expected_value": "params are not equal",
143
+ "params": [
144
+ { "name": "p1", "value": "aaa" },
145
+ { "name": "p2", "value": "bbb" }
146
+ ],
147
+ "template": "\n {{~#if (not_equal p1 p2)~}}\n params are not equal\n {{~/if~}}\n "
148
+ }
149
+ ],
150
+ "aliases": ["ne", "not_equal"],
151
+ "require_path": "handlebars/helpers/comparison/ne",
152
+ "class_namespace": "Handlebars::Helpers::Comparison::Ne",
153
+ "is_string_formatter": null
154
+ },
155
+ {
156
+ "name": "lt",
157
+ "description": "return block when first parameter is less than second paramater",
158
+ "test_in": null,
159
+ "test_out": null,
160
+ "tests": [
161
+ {
162
+ "alias": "lt",
163
+ "expected_value": "1 is less than 2",
164
+ "params": [
165
+ { "name": "p1", "value": 1 },
166
+ { "name": "p2", "value": 2 }
167
+ ],
168
+ "template": "\n {{~#if (lt p1 p2)~}}\n 1 is less than 2\n {{~/if~}}\n "
169
+ },
170
+ {
171
+ "alias": "less_than",
172
+ "expected_value": "1 is less than 2",
173
+ "params": [
174
+ { "name": "p1", "value": 1 },
175
+ { "name": "p2", "value": 2 }
176
+ ],
177
+ "template": "\n {{~#if (less_than p1 p2)~}}\n 1 is less than 2\n {{~/if~}}\n "
178
+ }
179
+ ],
180
+ "aliases": ["lt", "less_than"],
181
+ "require_path": "handlebars/helpers/comparison/lt",
182
+ "class_namespace": "Handlebars::Helpers::Comparison::Lt",
183
+ "is_string_formatter": null
184
+ },
185
+ {
186
+ "name": "lte",
187
+ "description": "return block when first parameter is less than or equal to second paramater",
188
+ "test_in": null,
189
+ "test_out": null,
190
+ "tests": [
191
+ {
192
+ "alias": "lte",
193
+ "expected_value": "1 is less than or equal 1",
194
+ "params": [
195
+ { "name": "p1", "value": 1 },
196
+ { "name": "p2", "value": 1 }
197
+ ],
198
+ "template": "\n {{~#if (lte p1 p2)~}}\n 1 is less than or equal 1\n {{~/if~}}\n "
199
+ },
200
+ {
201
+ "alias": "less_than_or_equal_to",
202
+ "expected_value": "1 is less than or equal 1",
203
+ "params": [
204
+ { "name": "p1", "value": 1 },
205
+ { "name": "p2", "value": 1 }
206
+ ],
207
+ "template": "\n {{~#if (less_than_or_equal_to p1 p2)~}}\n 1 is less than or equal 1\n {{~/if~}}\n "
208
+ }
209
+ ],
210
+ "aliases": ["lte", "less_than_or_equal_to"],
211
+ "require_path": "handlebars/helpers/comparison/lte",
212
+ "class_namespace": "Handlebars::Helpers::Comparison::Lte",
213
+ "is_string_formatter": null
214
+ },
215
+ {
216
+ "name": "gt",
217
+ "description": "return block when first parameter is greater than second paramater",
218
+ "test_in": null,
219
+ "test_out": null,
220
+ "tests": [
221
+ {
222
+ "alias": "gt",
223
+ "expected_value": "2 is greater than 1",
224
+ "params": [
225
+ { "name": "p1", "value": 2 },
226
+ { "name": "p2", "value": 1 }
227
+ ],
228
+ "template": "\n {{~#if (gt p1 p2)~}}\n 2 is greater than 1\n {{~/if~}}\n "
229
+ },
230
+ {
231
+ "alias": "greater_than",
232
+ "expected_value": "2 is greater than 1",
233
+ "params": [
234
+ { "name": "p1", "value": 2 },
235
+ { "name": "p2", "value": 1 }
236
+ ],
237
+ "template": "\n {{~#if (greater_than p1 p2)~}}\n 2 is greater than 1\n {{~/if~}}\n "
238
+ }
239
+ ],
240
+ "aliases": ["gt", "greater_than"],
241
+ "require_path": "handlebars/helpers/comparison/gt",
242
+ "class_namespace": "Handlebars::Helpers::Comparison::Gt",
243
+ "is_string_formatter": null
244
+ },
245
+ {
246
+ "name": "gte",
247
+ "description": "return block when first parameter is greater than or equal to second paramater",
248
+ "test_in": null,
249
+ "test_out": null,
250
+ "tests": [
251
+ {
252
+ "alias": "gte",
253
+ "expected_value": "1 is greater than or equal 1",
254
+ "params": [
255
+ { "name": "p1", "value": 1 },
256
+ { "name": "p2", "value": 1 }
257
+ ],
258
+ "template": "\n {{~#if (gte p1 p2)~}}\n 1 is greater than or equal 1\n {{~/if~}}\n "
259
+ },
260
+ {
261
+ "alias": "greater_than_or_equal_to",
262
+ "expected_value": "1 is greater than or equal 1",
263
+ "params": [
264
+ { "name": "p1", "value": 1 },
265
+ { "name": "p2", "value": 1 }
266
+ ],
267
+ "template": "\n {{~#if (greater_than_or_equal_to p1 p2)~}}\n 1 is greater than or equal 1\n {{~/if~}}\n "
268
+ }
269
+ ],
270
+ "aliases": ["gte", "greater_than_or_equal_to"],
271
+ "require_path": "handlebars/helpers/comparison/gte",
272
+ "class_namespace": "Handlebars::Helpers::Comparison::Gte",
273
+ "is_string_formatter": null
274
+ }
275
+ ]
276
+ },
277
+ {
278
+ "active": true,
279
+ "name": "inflection",
280
+ "base_require": "handlebars/helpers/inflection",
281
+ "base_namespace": "Handlebars::Helpers::Inflection",
282
+ "description": "Inflection handling routines, eg. pluralize, singular, ordinalize",
283
+ "examples": [
284
+ "https://github.com/helpers/handlebars-helpers/blob/master/lib/inflection.js",
285
+ "https://github.com/helpers/handlebars-helpers/blob/master/test/inflection.js"
286
+ ],
287
+ "helpers": [
288
+ {
289
+ "name": "ordinalize",
290
+ "description": "number value turned to 1st, 2nd, 3rd, 4th etc.",
291
+ "test_in": "1",
292
+ "test_out": "1st",
293
+ "tests": [{ "alias": "ordinalize" }],
294
+ "aliases": ["ordinalize"],
295
+ "require_path": "handlebars/helpers/inflection/ordinalize",
296
+ "class_namespace": "Handlebars::Helpers::Inflection::Ordinalize",
297
+ "is_string_formatter": true
298
+ },
299
+ {
300
+ "name": "ordinal",
301
+ "description": "ordinal suffix that would be required for a number, eg. st, nd, rd, th",
302
+ "test_in": "1",
303
+ "test_out": "st",
304
+ "tests": [{ "alias": "ordinal" }],
305
+ "aliases": ["ordinal"],
306
+ "require_path": "handlebars/helpers/inflection/ordinal",
307
+ "class_namespace": "Handlebars::Helpers::Inflection::Ordinal",
308
+ "is_string_formatter": true
309
+ },
310
+ {
311
+ "name": "pluralize_by_number",
312
+ "description": "use number/count to determine pluralization",
313
+ "test_in": null,
314
+ "test_out": null,
315
+ "tests": [
316
+ {
317
+ "alias": "pluralize_by_number",
318
+ "expected_value": "3 people",
319
+ "params": [
320
+ { "name": "value", "value": "person" },
321
+ { "name": "count", "value": "3" },
322
+ { "name": "format", "value": "number_word" }
323
+ ],
324
+ "template": "{{pluralize_by_number value count format}}"
325
+ }
326
+ ],
327
+ "aliases": ["pluralize_by_number"],
328
+ "require_path": "handlebars/helpers/inflection/pluralize_by_number",
329
+ "class_namespace": "Handlebars::Helpers::Inflection::PluralizeByNumber",
330
+ "is_string_formatter": null
331
+ },
332
+ {
333
+ "name": "pluralize",
334
+ "description": "singular value is converted to plural form",
335
+ "test_in": "category",
336
+ "test_out": "categories",
337
+ "tests": [{ "alias": "pluralize" }, { "alias": "plural" }],
338
+ "aliases": ["pluralize", "plural"],
339
+ "require_path": "handlebars/helpers/inflection/pluralize",
340
+ "class_namespace": "Handlebars::Helpers::Inflection::Pluralize",
341
+ "is_string_formatter": true
342
+ },
343
+ {
344
+ "name": "singularize",
345
+ "description": "plural value is converted to singular from",
346
+ "test_in": "categories",
347
+ "test_out": "category",
348
+ "tests": [{ "alias": "singularize" }, { "alias": "singular" }],
349
+ "aliases": ["singularize", "singular"],
350
+ "require_path": "handlebars/helpers/inflection/singularize",
351
+ "class_namespace": "Handlebars::Helpers::Inflection::Singularize",
352
+ "is_string_formatter": true
353
+ }
354
+ ]
355
+ },
356
+ {
357
+ "active": true,
358
+ "name": "code_ruby",
359
+ "base_require": "handlebars/helpers/code_ruby",
360
+ "base_namespace": "Handlebars::Helpers::CodeRuby",
361
+ "description": "Ruby code handling routines",
362
+ "examples": [
363
+ "https://github.com/helpers/handlebars-helpers/blob/master/lib/code.js",
364
+ "https://github.com/helpers/handlebars-helpers/blob/master/test/code.js"
365
+ ],
366
+ "helpers": [
367
+ {
368
+ "name": "classify",
369
+ "description": "return class name from a plural table name like Rails does for table names to models",
370
+ "test_in": null,
371
+ "test_out": null,
372
+ "tests": [
373
+ {
374
+ "alias": "classify",
375
+ "expected_value": "ProductCategory",
376
+ "params": [
377
+ { "name": "table_name", "value": "product_categories" }
378
+ ],
379
+ "template": "{{classify table_name}}"
380
+ }
381
+ ],
382
+ "aliases": ["classify"],
383
+ "require_path": "handlebars/helpers/code_ruby/classify",
384
+ "class_namespace": "Handlebars::Helpers::CodeRuby::Classify",
385
+ "is_string_formatter": null
386
+ },
387
+ {
388
+ "name": "demodulize",
389
+ "description": "removes the module part from the expression in the string",
390
+ "test_in": null,
391
+ "test_out": null,
392
+ "tests": [
393
+ {
394
+ "alias": "demodulize",
395
+ "expected_value": "Inflections",
396
+ "params": [
397
+ {
398
+ "name": "namespaced_class",
399
+ "value": "ActiveSupport::Inflector::Inflections"
400
+ }
401
+ ],
402
+ "template": "{{demodulize namespaced_class}}"
403
+ }
404
+ ],
405
+ "aliases": ["demodulize"],
406
+ "require_path": "handlebars/helpers/code_ruby/demodulize",
407
+ "class_namespace": "Handlebars::Helpers::CodeRuby::Demodulize",
408
+ "is_string_formatter": null
409
+ },
410
+ {
411
+ "name": "deconstantize",
412
+ "description": "remove the rightmost segment from the constant expression in the string",
413
+ "test_in": null,
414
+ "test_out": null,
415
+ "tests": [
416
+ {
417
+ "alias": "deconstantize",
418
+ "expected_value": "Net",
419
+ "params": [
420
+ { "name": "constant_expression", "value": "Net::HTTP" }
421
+ ],
422
+ "template": "{{deconstantize constant_expression}}"
423
+ }
424
+ ],
425
+ "aliases": ["deconstantize"],
426
+ "require_path": "handlebars/helpers/code_ruby/deconstantize",
427
+ "class_namespace": "Handlebars::Helpers::CodeRuby::Deconstantize",
428
+ "is_string_formatter": null
429
+ },
430
+ {
431
+ "name": "foreign_key",
432
+ "description": "creates a foreign key name from a class name.",
433
+ "test_in": null,
434
+ "test_out": null,
435
+ "tests": [
436
+ {
437
+ "alias": "foreign_key",
438
+ "expected_value": "message_id",
439
+ "params": [{ "name": "class_name", "value": "Message" }],
440
+ "template": "{{foreign_key class_name}}"
441
+ }
442
+ ],
443
+ "aliases": ["foreign_key"],
444
+ "require_path": "handlebars/helpers/code_ruby/foreign_key",
445
+ "class_namespace": "Handlebars::Helpers::CodeRuby::ForeignKey",
446
+ "is_string_formatter": null
447
+ },
448
+ {
449
+ "name": "tableize",
450
+ "description": "creates the name of a table like Rails does when converting models to table names",
451
+ "test_in": null,
452
+ "test_out": null,
453
+ "tests": [
454
+ {
455
+ "alias": "tableize",
456
+ "expected_value": "product_categories",
457
+ "params": [{ "name": "model_name", "value": "product_category" }],
458
+ "template": "{{tableize model_name}}"
459
+ }
460
+ ],
461
+ "aliases": ["tableize"],
462
+ "require_path": "handlebars/helpers/code_ruby/tableize",
463
+ "class_namespace": "Handlebars::Helpers::CodeRuby::Tableize",
464
+ "is_string_formatter": true
465
+ }
466
+ ]
467
+ },
468
+ {
469
+ "active": true,
470
+ "name": "string_formatting",
471
+ "base_require": "handlebars/helpers/string_formatting",
472
+ "base_namespace": "Handlebars::Helpers::StringFormatting",
473
+ "description": "String formatting and manipulation methods",
474
+ "examples": null,
475
+ "helpers": [
476
+ {
477
+ "name": "format_as",
478
+ "description": "returns a value that has been processed by multiple formatters",
479
+ "test_in": null,
480
+ "test_out": null,
481
+ "tests": [
482
+ {
483
+ "alias": "format_as",
484
+ "expected_value": "the-quick-brown-foxes",
485
+ "params": [
486
+ { "name": "value", "value": "the quick brown fox" },
487
+ { "name": "format", "value": "pluralize,dashify" }
488
+ ],
489
+ "template": "{{format_as value format}}"
490
+ }
491
+ ],
492
+ "aliases": ["format_as"],
493
+ "require_path": "handlebars/helpers/string_formatting/format_as",
494
+ "class_namespace": "Handlebars::Helpers::StringFormatting::FormatAs",
495
+ "is_string_formatter": null
496
+ },
497
+ {
498
+ "name": "back_slash",
499
+ "description": "convert to back slash notation",
500
+ "test_in": "the quick brown fox",
501
+ "test_out": "the\\quick\\brown\\fox",
502
+ "tests": [
503
+ { "alias": "back_slash" },
504
+ { "alias": "backward_slash" },
505
+ { "alias": "slash_backward" }
506
+ ],
507
+ "aliases": ["back_slash", "backward_slash", "slash_backward"],
508
+ "require_path": "handlebars/helpers/string_formatting/back_slash",
509
+ "class_namespace": "Handlebars::Helpers::StringFormatting::BackSlash",
510
+ "is_string_formatter": true
511
+ },
512
+ {
513
+ "name": "camel",
514
+ "description": "convert to camel case with first word uppercase and following words uppercase",
515
+ "test_in": "the quick brown fox",
516
+ "test_out": "TheQuickBrownFox",
517
+ "tests": [
518
+ { "alias": "camel" },
519
+ { "alias": "camel_upper" },
520
+ { "alias": "camelUpper" },
521
+ { "alias": "camelU" },
522
+ { "alias": "pascalcase" }
523
+ ],
524
+ "aliases": [
525
+ "camel",
526
+ "camel_upper",
527
+ "camelUpper",
528
+ "camelU",
529
+ "pascalcase"
530
+ ],
531
+ "require_path": "handlebars/helpers/string_formatting/camel",
532
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Camel",
533
+ "is_string_formatter": true
534
+ },
535
+ {
536
+ "name": "constantize",
537
+ "description": "convert to constant case",
538
+ "test_in": "the quick brown fox",
539
+ "test_out": "THE_QUICK_BROWN_FOX",
540
+ "tests": [{ "alias": "constantize" }, { "alias": "constant" }],
541
+ "aliases": ["constantize", "constant"],
542
+ "require_path": "handlebars/helpers/string_formatting/constantize",
543
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Constantize",
544
+ "is_string_formatter": true
545
+ },
546
+ {
547
+ "name": "dasherize",
548
+ "description": "convert to dash notation",
549
+ "test_in": "the quick brown fox",
550
+ "test_out": "the-quick-brown-fox",
551
+ "tests": [
552
+ { "alias": "dasherize" },
553
+ { "alias": "dashify" },
554
+ { "alias": "dashcase" },
555
+ { "alias": "hyphenate" }
556
+ ],
557
+ "aliases": ["dasherize", "dashify", "dashcase", "hyphenate"],
558
+ "require_path": "handlebars/helpers/string_formatting/dasherize",
559
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Dasherize",
560
+ "is_string_formatter": true
561
+ },
562
+ {
563
+ "name": "dotirize",
564
+ "description": "convert to dash notation",
565
+ "test_in": "the quick brown fox",
566
+ "test_out": "the.quick.brown.fox",
567
+ "tests": [
568
+ { "alias": "dotirize" },
569
+ { "alias": "dotify" },
570
+ { "alias": "dotcase" }
571
+ ],
572
+ "aliases": ["dotirize", "dotify", "dotcase"],
573
+ "require_path": "handlebars/helpers/string_formatting/dotirize",
574
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Dotirize",
575
+ "is_string_formatter": true
576
+ },
577
+ {
578
+ "name": "double_colon",
579
+ "description": "double_colon notation, similar to ruby namespace",
580
+ "test_in": "the quick brown fox",
581
+ "test_out": "the::quick::brown::fox",
582
+ "tests": [{ "alias": "double_colon" }],
583
+ "aliases": ["double_colon"],
584
+ "require_path": "handlebars/helpers/string_formatting/double_colon",
585
+ "class_namespace": "Handlebars::Helpers::StringFormatting::DoubleColon",
586
+ "is_string_formatter": true
587
+ },
588
+ {
589
+ "name": "downcase",
590
+ "description": "convert all characters to lower case",
591
+ "test_in": "THE QUICK BROWN FOX",
592
+ "test_out": "the quick brown fox",
593
+ "tests": [{ "alias": "downcase" }, { "alias": "lowercase" }],
594
+ "aliases": ["downcase", "lowercase"],
595
+ "require_path": "handlebars/helpers/string_formatting/downcase",
596
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Downcase",
597
+ "is_string_formatter": true
598
+ },
599
+ {
600
+ "name": "humanize",
601
+ "description": "convert text to human case, aka capitalize",
602
+ "test_in": "the Quick Brown Fox",
603
+ "test_out": "The quick brown fox",
604
+ "tests": [{ "alias": "humanize" }, { "alias": "capitalize" }],
605
+ "aliases": ["humanize", "capitalize"],
606
+ "require_path": "handlebars/helpers/string_formatting/humanize",
607
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Humanize",
608
+ "is_string_formatter": true
609
+ },
610
+ {
611
+ "name": "lamel",
612
+ "description": "convert to lamel case with first word lowercase and following words uppercase",
613
+ "test_in": "The quick brown fox",
614
+ "test_out": "theQuickBrownFox",
615
+ "tests": [
616
+ { "alias": "lamel" },
617
+ { "alias": "camel_lower" },
618
+ { "alias": "camelLower" },
619
+ { "alias": "camelL" }
620
+ ],
621
+ "aliases": ["lamel", "camel_lower", "camelLower", "camelL"],
622
+ "require_path": "handlebars/helpers/string_formatting/lamel",
623
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Lamel",
624
+ "is_string_formatter": true
625
+ },
626
+ {
627
+ "name": "pluserize",
628
+ "description": "convert to plus notation",
629
+ "test_in": "the quick brown fox",
630
+ "test_out": "the+quick+brown+fox",
631
+ "tests": [
632
+ { "alias": "pluserize" },
633
+ { "alias": "plusify" },
634
+ { "alias": "pluscase" }
635
+ ],
636
+ "aliases": ["pluserize", "plusify", "pluscase"],
637
+ "require_path": "handlebars/helpers/string_formatting/pluserize",
638
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Pluserize",
639
+ "is_string_formatter": true
640
+ },
641
+ {
642
+ "name": "slash",
643
+ "description": "convert to slash notation, aka forward slash",
644
+ "test_in": "the Quick brown Fox",
645
+ "test_out": "the/Quick/brown/Fox",
646
+ "tests": [
647
+ { "alias": "slash" },
648
+ { "alias": "forward_slash" },
649
+ { "alias": "slash_forward" }
650
+ ],
651
+ "aliases": ["slash", "forward_slash", "slash_forward"],
652
+ "require_path": "handlebars/helpers/string_formatting/slash",
653
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Slash",
654
+ "is_string_formatter": true
655
+ },
656
+ {
657
+ "name": "snake",
658
+ "description": "convert to snake notation",
659
+ "test_in": "the quick brown fox",
660
+ "test_out": "the_quick_brown_fox",
661
+ "tests": [{ "alias": "snake" }],
662
+ "aliases": ["snake"],
663
+ "require_path": "handlebars/helpers/string_formatting/snake",
664
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Snake",
665
+ "is_string_formatter": true
666
+ },
667
+ {
668
+ "name": "titleize",
669
+ "description": "value converted to titleize case, aka heading case",
670
+ "test_in": "the quick brown fox",
671
+ "test_out": "The Quick Brown Fox",
672
+ "tests": [
673
+ { "alias": "titleize" },
674
+ { "alias": "heading" },
675
+ { "alias": "capitalize_all" }
676
+ ],
677
+ "aliases": ["titleize", "heading", "capitalize_all"],
678
+ "require_path": "handlebars/helpers/string_formatting/titleize",
679
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Titleize",
680
+ "is_string_formatter": true
681
+ },
682
+ {
683
+ "name": "upcase",
684
+ "description": "convert all characters to lower case",
685
+ "test_in": "The quick brown fox",
686
+ "test_out": "THE QUICK BROWN FOX",
687
+ "tests": [{ "alias": "upcase" }, { "alias": "uppercase" }],
688
+ "aliases": ["upcase", "uppercase"],
689
+ "require_path": "handlebars/helpers/string_formatting/upcase",
690
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Upcase",
691
+ "is_string_formatter": true
692
+ },
693
+ {
694
+ "name": "padr",
695
+ "description": "returns value with padding to right",
696
+ "test_in": null,
697
+ "test_out": null,
698
+ "tests": [
699
+ {
700
+ "alias": "padr",
701
+ "expected_value": "pad-me....",
702
+ "params": [
703
+ { "name": "value", "value": "pad-me" },
704
+ { "name": "count", "value": 10 },
705
+ { "name": "char", "value": "." }
706
+ ],
707
+ "template": "{{padr value count char}}"
708
+ },
709
+ {
710
+ "alias": "pad_right",
711
+ "expected_value": "pad-me....",
712
+ "params": [
713
+ { "name": "value", "value": "pad-me" },
714
+ { "name": "count", "value": 10 },
715
+ { "name": "char", "value": "." }
716
+ ],
717
+ "template": "{{pad_right value count char}}"
718
+ },
719
+ {
720
+ "alias": "ljust",
721
+ "expected_value": "pad-me....",
722
+ "params": [
723
+ { "name": "value", "value": "pad-me" },
724
+ { "name": "count", "value": 10 },
725
+ { "name": "char", "value": "." }
726
+ ],
727
+ "template": "{{ljust value count char}}"
728
+ }
729
+ ],
730
+ "aliases": ["padr", "pad_right", "ljust"],
731
+ "require_path": "handlebars/helpers/string_formatting/padr",
732
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Padr",
733
+ "is_string_formatter": null
734
+ },
735
+ {
736
+ "name": "padl",
737
+ "description": "returns value with padding to left",
738
+ "test_in": null,
739
+ "test_out": null,
740
+ "tests": [
741
+ {
742
+ "alias": "padl",
743
+ "expected_value": "....pad-me",
744
+ "params": [
745
+ { "name": "value", "value": "pad-me" },
746
+ { "name": "count", "value": 10 },
747
+ { "name": "char", "value": "." }
748
+ ],
749
+ "template": "{{padl value count char}}"
750
+ },
751
+ {
752
+ "alias": "pad_left",
753
+ "expected_value": "....pad-me",
754
+ "params": [
755
+ { "name": "value", "value": "pad-me" },
756
+ { "name": "count", "value": 10 },
757
+ { "name": "char", "value": "." }
758
+ ],
759
+ "template": "{{pad_left value count char}}"
760
+ },
761
+ {
762
+ "alias": "rjust",
763
+ "expected_value": "....pad-me",
764
+ "params": [
765
+ { "name": "value", "value": "pad-me" },
766
+ { "name": "count", "value": 10 },
767
+ { "name": "char", "value": "." }
768
+ ],
769
+ "template": "{{rjust value count char}}"
770
+ }
771
+ ],
772
+ "aliases": ["padl", "pad_left", "rjust"],
773
+ "require_path": "handlebars/helpers/string_formatting/padl",
774
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Padl",
775
+ "is_string_formatter": null
776
+ },
777
+ {
778
+ "name": "prepend_if",
779
+ "description": "returns value with prefix if the value is present?",
780
+ "test_in": null,
781
+ "test_out": null,
782
+ "tests": [
783
+ {
784
+ "alias": "prepend_if",
785
+ "expected_value": "# product_categories",
786
+ "params": [
787
+ { "name": "value", "value": "product category" },
788
+ { "name": "prefix", "value": "# " },
789
+ { "name": "formats", "value": "pluralize,snake" }
790
+ ],
791
+ "template": "{{prepend_if value prefix formats}}"
792
+ },
793
+ {
794
+ "alias": "prefix_if",
795
+ "expected_value": "# product_categories",
796
+ "params": [
797
+ { "name": "value", "value": "product category" },
798
+ { "name": "prefix", "value": "# " },
799
+ { "name": "formats", "value": "pluralize,snake" }
800
+ ],
801
+ "template": "{{prefix_if value prefix formats}}"
802
+ }
803
+ ],
804
+ "aliases": ["prepend_if", "prefix_if"],
805
+ "require_path": "handlebars/helpers/string_formatting/prepend_if",
806
+ "class_namespace": "Handlebars::Helpers::StringFormatting::PrependIf",
807
+ "is_string_formatter": null
808
+ },
809
+ {
810
+ "name": "append_if",
811
+ "description": "returns value with suffix if the value is present?",
812
+ "test_in": null,
813
+ "test_out": null,
814
+ "tests": [
815
+ {
816
+ "alias": "append_if",
817
+ "expected_value": "product_categories:",
818
+ "params": [
819
+ { "name": "value", "value": "product category" },
820
+ { "name": "suffix", "value": ":" },
821
+ { "name": "formats", "value": "pluralize,snake" }
822
+ ],
823
+ "template": "{{append_if value suffix formats}}"
824
+ },
825
+ {
826
+ "alias": "suffix_if",
827
+ "expected_value": "product_categories:",
828
+ "params": [
829
+ { "name": "value", "value": "product category" },
830
+ { "name": "suffix", "value": ":" },
831
+ { "name": "formats", "value": "pluralize,snake" }
832
+ ],
833
+ "template": "{{suffix_if value suffix formats}}"
834
+ }
835
+ ],
836
+ "aliases": ["append_if", "suffix_if"],
837
+ "require_path": "handlebars/helpers/string_formatting/append_if",
838
+ "class_namespace": "Handlebars::Helpers::StringFormatting::AppendIf",
839
+ "is_string_formatter": null
840
+ },
841
+ {
842
+ "name": "surround_if",
843
+ "description": "returns value with surrounding prefix/suffix if the value is present?",
844
+ "test_in": null,
845
+ "test_out": null,
846
+ "tests": [
847
+ {
848
+ "alias": "surround_if",
849
+ "expected_value": "(product_categories)",
850
+ "params": [
851
+ { "name": "value", "value": "product category" },
852
+ { "name": "prefix", "value": "(" },
853
+ { "name": "suffix", "value": ")" },
854
+ { "name": "formats", "value": "pluralize,snake" }
855
+ ],
856
+ "template": "{{surround_if value prefix suffix formats}}"
857
+ },
858
+ {
859
+ "alias": "surround_if_value",
860
+ "expected_value": "(product_categories)",
861
+ "params": [
862
+ { "name": "value", "value": "product category" },
863
+ { "name": "prefix", "value": "(" },
864
+ { "name": "suffix", "value": ")" },
865
+ { "name": "formats", "value": "pluralize,snake" }
866
+ ],
867
+ "template": "{{surround_if_value value prefix suffix formats}}"
868
+ }
869
+ ],
870
+ "aliases": ["surround_if", "surround_if_value"],
871
+ "require_path": "handlebars/helpers/string_formatting/surround_if",
872
+ "class_namespace": "Handlebars::Helpers::StringFormatting::SurroundIf",
873
+ "is_string_formatter": null
874
+ },
875
+ {
876
+ "name": "surround",
877
+ "description": "returns value with surrounding prefix/suffix",
878
+ "test_in": null,
879
+ "test_out": null,
880
+ "tests": [
881
+ {
882
+ "alias": "surround",
883
+ "expected_value": "()",
884
+ "params": [
885
+ { "name": "value", "value": null },
886
+ { "name": "prefix", "value": "(" },
887
+ { "name": "suffix", "value": ")" },
888
+ { "name": "formats", "value": "" }
889
+ ],
890
+ "template": "{{surround value prefix suffix formats}}"
891
+ }
892
+ ],
893
+ "aliases": ["surround"],
894
+ "require_path": "handlebars/helpers/string_formatting/surround",
895
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Surround",
896
+ "is_string_formatter": null
897
+ }
898
+ ]
899
+ }
900
+ ]
901
+ }