handlebars-helpers 0.0.5 → 0.0.73

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -3
  3. data/.gitignore +1 -0
  4. data/.handlebars_helpers.json +956 -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/README.md +31 -3
  10. data/Rakefile +1 -0
  11. data/STORIES.md +55 -7
  12. data/USAGE.md +1 -1
  13. data/bin/console +1 -1
  14. data/handlebars-helpers.gemspec +10 -1
  15. data/lib/handlebars/helpers.rb +2 -0
  16. data/lib/handlebars/helpers/base_helper.rb +36 -0
  17. data/lib/handlebars/helpers/base_safe_string_helper.rb +17 -0
  18. data/lib/handlebars/helpers/code_ruby/classify.rb +40 -0
  19. data/lib/handlebars/helpers/code_ruby/deconstantize.rb +48 -0
  20. data/lib/handlebars/helpers/code_ruby/demodulize.rb +58 -0
  21. data/lib/handlebars/helpers/code_ruby/foreign_key.rb +49 -0
  22. data/lib/handlebars/helpers/code_ruby/tableize.rb +35 -0
  23. data/lib/handlebars/helpers/comparison/and.rb +44 -0
  24. data/lib/handlebars/helpers/comparison/default.rb +66 -0
  25. data/lib/handlebars/helpers/comparison/eq.rb +35 -0
  26. data/lib/handlebars/helpers/comparison/gt.rb +35 -0
  27. data/lib/handlebars/helpers/comparison/gte.rb +43 -0
  28. data/lib/handlebars/helpers/comparison/lt.rb +35 -0
  29. data/lib/handlebars/helpers/comparison/lte.rb +43 -0
  30. data/lib/handlebars/helpers/comparison/ne.rb +35 -0
  31. data/lib/handlebars/helpers/comparison/or.rb +56 -0
  32. data/lib/handlebars/helpers/configuration.rb +72 -0
  33. data/lib/handlebars/helpers/inflection/ordinal.rb +58 -0
  34. data/lib/handlebars/helpers/inflection/ordinalize.rb +59 -0
  35. data/lib/handlebars/helpers/inflection/pluralize.rb +36 -0
  36. data/lib/handlebars/helpers/inflection/pluralize_by_number.rb +60 -0
  37. data/lib/handlebars/helpers/inflection/singularize.rb +35 -0
  38. data/lib/handlebars/helpers/misc/noop.rb +36 -0
  39. data/lib/handlebars/helpers/misc/safe.rb +37 -0
  40. data/lib/handlebars/helpers/register_helpers.rb +73 -0
  41. data/lib/handlebars/helpers/string_formatting/append_if.rb +42 -0
  42. data/lib/handlebars/helpers/string_formatting/back_slash.rb +33 -0
  43. data/lib/handlebars/helpers/string_formatting/camel.rb +29 -0
  44. data/lib/handlebars/helpers/string_formatting/constantize.rb +29 -0
  45. data/lib/handlebars/helpers/string_formatting/dasherize.rb +33 -0
  46. data/lib/handlebars/helpers/string_formatting/dotirize.rb +33 -0
  47. data/lib/handlebars/helpers/string_formatting/double_colon.rb +33 -0
  48. data/lib/handlebars/helpers/string_formatting/downcase.rb +31 -0
  49. data/lib/handlebars/helpers/string_formatting/format_as.rb +57 -0
  50. data/lib/handlebars/helpers/string_formatting/humanize.rb +39 -0
  51. data/lib/handlebars/helpers/string_formatting/lamel.rb +29 -0
  52. data/lib/handlebars/helpers/string_formatting/padl.rb +58 -0
  53. data/lib/handlebars/helpers/string_formatting/padr.rb +59 -0
  54. data/lib/handlebars/helpers/string_formatting/pluserize.rb +29 -0
  55. data/lib/handlebars/helpers/string_formatting/prepend_if.rb +42 -0
  56. data/lib/handlebars/helpers/string_formatting/singularize.rb +35 -0
  57. data/lib/handlebars/helpers/string_formatting/slash.rb +33 -0
  58. data/lib/handlebars/helpers/string_formatting/snake.rb +33 -0
  59. data/lib/handlebars/helpers/string_formatting/string.js +511 -0
  60. data/lib/handlebars/helpers/string_formatting/surround.rb +49 -0
  61. data/lib/handlebars/helpers/string_formatting/surround_if.rb +43 -0
  62. data/lib/handlebars/helpers/string_formatting/titleize.rb +39 -0
  63. data/lib/handlebars/helpers/string_formatting/upcase.rb +31 -0
  64. data/lib/handlebars/helpers/string_tokenizer.rb +43 -0
  65. data/lib/handlebars/helpers/template.rb +68 -0
  66. data/lib/handlebars/helpers/version.rb +1 -1
  67. metadata +97 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57de8a5236ee35ac1688c825dce948981ac27f09c34fb85bbf9ad50df818bba1
4
- data.tar.gz: efe57a3018a4e9a450337f2532892baef6ee9d042c28ed9ea2745720e46aebc5
3
+ metadata.gz: 1f7856b8bedf4a0e767a79418770a54194fa2d0e54ac41437d5cdcf6b0445bcb
4
+ data.tar.gz: b00c84c817f59efed112319fc2135cab2b86fb54e4103274bd2e15cabb328f88
5
5
  SHA512:
6
- metadata.gz: 3ac2cf2f9bc9987d392bb26f515d81a0d999eb33c687bc3f7126a705d7e26674aa977ef7333cb6f42f095e7b7f3cc8cb24326c64a5785f58073f33a1252a29b6
7
- data.tar.gz: e8c51c96551e12329b75ac0a0a00902060322b1aeeb96d76b4cf1878cd229aff789a5a2f99e126b3a0107fce0f6beb6ed76427f6ebad94581187e3bc77319aef
6
+ metadata.gz: 02603ef2713d98b6259e38141c639a5763aee2bb025e21146c1cb6d66d6647c590f51a81f7dde4ea39ec459323448b6af1a4672cfc6779171f948d9187c97f53
7
+ data.tar.gz: ff545bd715a138248f730e1f99cf9cbbfb68b98f4faf1ed741d6fdf43e629b102bc6f71ec7731c758ba84e1b27108f89a411f20c242a7c52866bad5097562018
@@ -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,10 @@ 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
24
22
  with:
25
23
  ruby-version: 2.6
24
+ # bundler-cache: true # runs 'bundle install' and caches installed gems automatically
26
25
  - name: Install dependencies
27
26
  run: bundle install
28
27
  - 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,956 @@
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": "misc",
359
+ "base_require": "handlebars/helpers/misc",
360
+ "base_namespace": "Handlebars::Helpers::Misc",
361
+ "description": "Miscellaneous handling routines",
362
+ "examples": [
363
+ "https://github.com/helpers/handlebars-helpers/blob/master/lib/misc.js",
364
+ "https://github.com/helpers/handlebars-helpers/blob/master/test/misc.js"
365
+ ],
366
+ "helpers": [
367
+ {
368
+ "name": "safe",
369
+ "description": "value in safe string format",
370
+ "test_in": null,
371
+ "test_out": null,
372
+ "tests": [
373
+ {
374
+ "alias": "safe",
375
+ "expected_value": "\"hello\"",
376
+ "params": [{ "name": "value", "value": "\"hello\"" }],
377
+ "template": "{{safe value}}"
378
+ }
379
+ ],
380
+ "aliases": ["safe"],
381
+ "require_path": "handlebars/helpers/misc/safe",
382
+ "class_namespace": "Handlebars::Helpers::Misc::Safe",
383
+ "is_string_formatter": null
384
+ },
385
+ {
386
+ "name": "noop",
387
+ "description": "NoOp is a wrapper for blocks that does nothing, it is useful with the raw output operator",
388
+ "test_in": null,
389
+ "test_out": null,
390
+ "tests": [
391
+ {
392
+ "alias": "noop",
393
+ "expected_value": "{{no_parse}}",
394
+ "params": [],
395
+ "template": "{{{{noop}}}}{{no_parse}}{{{{/noop}}}}"
396
+ },
397
+ {
398
+ "alias": "raw",
399
+ "expected_value": "{{no_parse}}",
400
+ "params": [],
401
+ "template": "{{{{raw}}}}{{no_parse}}{{{{/raw}}}}"
402
+ }
403
+ ],
404
+ "aliases": ["noop", "raw"],
405
+ "require_path": "handlebars/helpers/misc/noop",
406
+ "class_namespace": "Handlebars::Helpers::Misc::Noop",
407
+ "is_string_formatter": null
408
+ }
409
+ ]
410
+ },
411
+ {
412
+ "active": true,
413
+ "name": "code_ruby",
414
+ "base_require": "handlebars/helpers/code_ruby",
415
+ "base_namespace": "Handlebars::Helpers::CodeRuby",
416
+ "description": "Ruby code handling routines",
417
+ "examples": [
418
+ "https://github.com/helpers/handlebars-helpers/blob/master/lib/code.js",
419
+ "https://github.com/helpers/handlebars-helpers/blob/master/test/code.js"
420
+ ],
421
+ "helpers": [
422
+ {
423
+ "name": "classify",
424
+ "description": "return class name from a plural table name like Rails does for table names to models",
425
+ "test_in": null,
426
+ "test_out": null,
427
+ "tests": [
428
+ {
429
+ "alias": "classify",
430
+ "expected_value": "ProductCategory",
431
+ "params": [
432
+ { "name": "table_name", "value": "product_categories" }
433
+ ],
434
+ "template": "{{classify table_name}}"
435
+ }
436
+ ],
437
+ "aliases": ["classify"],
438
+ "require_path": "handlebars/helpers/code_ruby/classify",
439
+ "class_namespace": "Handlebars::Helpers::CodeRuby::Classify",
440
+ "is_string_formatter": null
441
+ },
442
+ {
443
+ "name": "demodulize",
444
+ "description": "removes the module part from the expression in the string",
445
+ "test_in": null,
446
+ "test_out": null,
447
+ "tests": [
448
+ {
449
+ "alias": "demodulize",
450
+ "expected_value": "Inflections",
451
+ "params": [
452
+ {
453
+ "name": "namespaced_class",
454
+ "value": "ActiveSupport::Inflector::Inflections"
455
+ }
456
+ ],
457
+ "template": "{{demodulize namespaced_class}}"
458
+ }
459
+ ],
460
+ "aliases": ["demodulize"],
461
+ "require_path": "handlebars/helpers/code_ruby/demodulize",
462
+ "class_namespace": "Handlebars::Helpers::CodeRuby::Demodulize",
463
+ "is_string_formatter": null
464
+ },
465
+ {
466
+ "name": "deconstantize",
467
+ "description": "remove the rightmost segment from the constant expression in the string",
468
+ "test_in": null,
469
+ "test_out": null,
470
+ "tests": [
471
+ {
472
+ "alias": "deconstantize",
473
+ "expected_value": "Net",
474
+ "params": [
475
+ { "name": "constant_expression", "value": "Net::HTTP" }
476
+ ],
477
+ "template": "{{deconstantize constant_expression}}"
478
+ }
479
+ ],
480
+ "aliases": ["deconstantize"],
481
+ "require_path": "handlebars/helpers/code_ruby/deconstantize",
482
+ "class_namespace": "Handlebars::Helpers::CodeRuby::Deconstantize",
483
+ "is_string_formatter": null
484
+ },
485
+ {
486
+ "name": "foreign_key",
487
+ "description": "creates a foreign key name from a class name.",
488
+ "test_in": null,
489
+ "test_out": null,
490
+ "tests": [
491
+ {
492
+ "alias": "foreign_key",
493
+ "expected_value": "message_id",
494
+ "params": [{ "name": "class_name", "value": "Message" }],
495
+ "template": "{{foreign_key class_name}}"
496
+ }
497
+ ],
498
+ "aliases": ["foreign_key"],
499
+ "require_path": "handlebars/helpers/code_ruby/foreign_key",
500
+ "class_namespace": "Handlebars::Helpers::CodeRuby::ForeignKey",
501
+ "is_string_formatter": null
502
+ },
503
+ {
504
+ "name": "tableize",
505
+ "description": "creates the name of a table like Rails does when converting models to table names",
506
+ "test_in": null,
507
+ "test_out": null,
508
+ "tests": [
509
+ {
510
+ "alias": "tableize",
511
+ "expected_value": "product_categories",
512
+ "params": [{ "name": "model_name", "value": "product_category" }],
513
+ "template": "{{tableize model_name}}"
514
+ }
515
+ ],
516
+ "aliases": ["tableize"],
517
+ "require_path": "handlebars/helpers/code_ruby/tableize",
518
+ "class_namespace": "Handlebars::Helpers::CodeRuby::Tableize",
519
+ "is_string_formatter": true
520
+ }
521
+ ]
522
+ },
523
+ {
524
+ "active": true,
525
+ "name": "string_formatting",
526
+ "base_require": "handlebars/helpers/string_formatting",
527
+ "base_namespace": "Handlebars::Helpers::StringFormatting",
528
+ "description": "String formatting and manipulation methods",
529
+ "examples": null,
530
+ "helpers": [
531
+ {
532
+ "name": "format_as",
533
+ "description": "returns a value that has been processed by multiple formatters",
534
+ "test_in": null,
535
+ "test_out": null,
536
+ "tests": [
537
+ {
538
+ "alias": "format_as",
539
+ "expected_value": "the-quick-brown-foxes",
540
+ "params": [
541
+ { "name": "value", "value": "the quick brown fox" },
542
+ { "name": "format", "value": "pluralize,dashify" }
543
+ ],
544
+ "template": "{{format_as value format}}"
545
+ }
546
+ ],
547
+ "aliases": ["format_as"],
548
+ "require_path": "handlebars/helpers/string_formatting/format_as",
549
+ "class_namespace": "Handlebars::Helpers::StringFormatting::FormatAs",
550
+ "is_string_formatter": null
551
+ },
552
+ {
553
+ "name": "back_slash",
554
+ "description": "convert to back slash notation",
555
+ "test_in": "the quick brown fox",
556
+ "test_out": "the\\quick\\brown\\fox",
557
+ "tests": [
558
+ { "alias": "back_slash" },
559
+ { "alias": "backward_slash" },
560
+ { "alias": "slash_backward" }
561
+ ],
562
+ "aliases": ["back_slash", "backward_slash", "slash_backward"],
563
+ "require_path": "handlebars/helpers/string_formatting/back_slash",
564
+ "class_namespace": "Handlebars::Helpers::StringFormatting::BackSlash",
565
+ "is_string_formatter": true
566
+ },
567
+ {
568
+ "name": "camel",
569
+ "description": "convert to camel case with first word uppercase and following words uppercase",
570
+ "test_in": "the quick brown fox",
571
+ "test_out": "TheQuickBrownFox",
572
+ "tests": [
573
+ { "alias": "camel" },
574
+ { "alias": "camel_upper" },
575
+ { "alias": "camelUpper" },
576
+ { "alias": "camelU" },
577
+ { "alias": "pascalcase" }
578
+ ],
579
+ "aliases": [
580
+ "camel",
581
+ "camel_upper",
582
+ "camelUpper",
583
+ "camelU",
584
+ "pascalcase"
585
+ ],
586
+ "require_path": "handlebars/helpers/string_formatting/camel",
587
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Camel",
588
+ "is_string_formatter": true
589
+ },
590
+ {
591
+ "name": "constantize",
592
+ "description": "convert to constant case",
593
+ "test_in": "the quick brown fox",
594
+ "test_out": "THE_QUICK_BROWN_FOX",
595
+ "tests": [{ "alias": "constantize" }, { "alias": "constant" }],
596
+ "aliases": ["constantize", "constant"],
597
+ "require_path": "handlebars/helpers/string_formatting/constantize",
598
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Constantize",
599
+ "is_string_formatter": true
600
+ },
601
+ {
602
+ "name": "dasherize",
603
+ "description": "convert to dash notation",
604
+ "test_in": "the quick brown fox",
605
+ "test_out": "the-quick-brown-fox",
606
+ "tests": [
607
+ { "alias": "dasherize" },
608
+ { "alias": "dashify" },
609
+ { "alias": "dashcase" },
610
+ { "alias": "hyphenate" }
611
+ ],
612
+ "aliases": ["dasherize", "dashify", "dashcase", "hyphenate"],
613
+ "require_path": "handlebars/helpers/string_formatting/dasherize",
614
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Dasherize",
615
+ "is_string_formatter": true
616
+ },
617
+ {
618
+ "name": "dotirize",
619
+ "description": "convert to dash notation",
620
+ "test_in": "the quick brown fox",
621
+ "test_out": "the.quick.brown.fox",
622
+ "tests": [
623
+ { "alias": "dotirize" },
624
+ { "alias": "dotify" },
625
+ { "alias": "dotcase" }
626
+ ],
627
+ "aliases": ["dotirize", "dotify", "dotcase"],
628
+ "require_path": "handlebars/helpers/string_formatting/dotirize",
629
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Dotirize",
630
+ "is_string_formatter": true
631
+ },
632
+ {
633
+ "name": "double_colon",
634
+ "description": "double_colon notation, similar to ruby namespace",
635
+ "test_in": "the quick brown fox",
636
+ "test_out": "the::quick::brown::fox",
637
+ "tests": [{ "alias": "double_colon" }],
638
+ "aliases": ["double_colon"],
639
+ "require_path": "handlebars/helpers/string_formatting/double_colon",
640
+ "class_namespace": "Handlebars::Helpers::StringFormatting::DoubleColon",
641
+ "is_string_formatter": true
642
+ },
643
+ {
644
+ "name": "downcase",
645
+ "description": "convert all characters to lower case",
646
+ "test_in": "THE QUICK BROWN FOX",
647
+ "test_out": "the quick brown fox",
648
+ "tests": [{ "alias": "downcase" }, { "alias": "lowercase" }],
649
+ "aliases": ["downcase", "lowercase"],
650
+ "require_path": "handlebars/helpers/string_formatting/downcase",
651
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Downcase",
652
+ "is_string_formatter": true
653
+ },
654
+ {
655
+ "name": "humanize",
656
+ "description": "convert text to human case, aka capitalize",
657
+ "test_in": "the Quick Brown Fox",
658
+ "test_out": "The quick brown fox",
659
+ "tests": [{ "alias": "humanize" }, { "alias": "capitalize" }],
660
+ "aliases": ["humanize", "capitalize"],
661
+ "require_path": "handlebars/helpers/string_formatting/humanize",
662
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Humanize",
663
+ "is_string_formatter": true
664
+ },
665
+ {
666
+ "name": "lamel",
667
+ "description": "convert to lamel case with first word lowercase and following words uppercase",
668
+ "test_in": "The quick brown fox",
669
+ "test_out": "theQuickBrownFox",
670
+ "tests": [
671
+ { "alias": "lamel" },
672
+ { "alias": "camel_lower" },
673
+ { "alias": "camelLower" },
674
+ { "alias": "camelL" }
675
+ ],
676
+ "aliases": ["lamel", "camel_lower", "camelLower", "camelL"],
677
+ "require_path": "handlebars/helpers/string_formatting/lamel",
678
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Lamel",
679
+ "is_string_formatter": true
680
+ },
681
+ {
682
+ "name": "pluserize",
683
+ "description": "convert to plus notation",
684
+ "test_in": "the quick brown fox",
685
+ "test_out": "the+quick+brown+fox",
686
+ "tests": [
687
+ { "alias": "pluserize" },
688
+ { "alias": "plusify" },
689
+ { "alias": "pluscase" }
690
+ ],
691
+ "aliases": ["pluserize", "plusify", "pluscase"],
692
+ "require_path": "handlebars/helpers/string_formatting/pluserize",
693
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Pluserize",
694
+ "is_string_formatter": true
695
+ },
696
+ {
697
+ "name": "slash",
698
+ "description": "convert to slash notation, aka forward slash",
699
+ "test_in": "the Quick brown Fox",
700
+ "test_out": "the/Quick/brown/Fox",
701
+ "tests": [
702
+ { "alias": "slash" },
703
+ { "alias": "forward_slash" },
704
+ { "alias": "slash_forward" }
705
+ ],
706
+ "aliases": ["slash", "forward_slash", "slash_forward"],
707
+ "require_path": "handlebars/helpers/string_formatting/slash",
708
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Slash",
709
+ "is_string_formatter": true
710
+ },
711
+ {
712
+ "name": "snake",
713
+ "description": "convert to snake notation",
714
+ "test_in": "the quick brown fox",
715
+ "test_out": "the_quick_brown_fox",
716
+ "tests": [{ "alias": "snake" }],
717
+ "aliases": ["snake"],
718
+ "require_path": "handlebars/helpers/string_formatting/snake",
719
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Snake",
720
+ "is_string_formatter": true
721
+ },
722
+ {
723
+ "name": "titleize",
724
+ "description": "value converted to titleize case, aka heading case",
725
+ "test_in": "the quick brown fox",
726
+ "test_out": "The Quick Brown Fox",
727
+ "tests": [
728
+ { "alias": "titleize" },
729
+ { "alias": "heading" },
730
+ { "alias": "capitalize_all" }
731
+ ],
732
+ "aliases": ["titleize", "heading", "capitalize_all"],
733
+ "require_path": "handlebars/helpers/string_formatting/titleize",
734
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Titleize",
735
+ "is_string_formatter": true
736
+ },
737
+ {
738
+ "name": "upcase",
739
+ "description": "convert all characters to lower case",
740
+ "test_in": "The quick brown fox",
741
+ "test_out": "THE QUICK BROWN FOX",
742
+ "tests": [{ "alias": "upcase" }, { "alias": "uppercase" }],
743
+ "aliases": ["upcase", "uppercase"],
744
+ "require_path": "handlebars/helpers/string_formatting/upcase",
745
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Upcase",
746
+ "is_string_formatter": true
747
+ },
748
+ {
749
+ "name": "padr",
750
+ "description": "returns value with padding to right",
751
+ "test_in": null,
752
+ "test_out": null,
753
+ "tests": [
754
+ {
755
+ "alias": "padr",
756
+ "expected_value": "pad-me....",
757
+ "params": [
758
+ { "name": "value", "value": "pad-me" },
759
+ { "name": "count", "value": 10 },
760
+ { "name": "char", "value": "." }
761
+ ],
762
+ "template": "{{padr value count char}}"
763
+ },
764
+ {
765
+ "alias": "pad_right",
766
+ "expected_value": "pad-me....",
767
+ "params": [
768
+ { "name": "value", "value": "pad-me" },
769
+ { "name": "count", "value": 10 },
770
+ { "name": "char", "value": "." }
771
+ ],
772
+ "template": "{{pad_right value count char}}"
773
+ },
774
+ {
775
+ "alias": "ljust",
776
+ "expected_value": "pad-me....",
777
+ "params": [
778
+ { "name": "value", "value": "pad-me" },
779
+ { "name": "count", "value": 10 },
780
+ { "name": "char", "value": "." }
781
+ ],
782
+ "template": "{{ljust value count char}}"
783
+ }
784
+ ],
785
+ "aliases": ["padr", "pad_right", "ljust"],
786
+ "require_path": "handlebars/helpers/string_formatting/padr",
787
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Padr",
788
+ "is_string_formatter": null
789
+ },
790
+ {
791
+ "name": "padl",
792
+ "description": "returns value with padding to left",
793
+ "test_in": null,
794
+ "test_out": null,
795
+ "tests": [
796
+ {
797
+ "alias": "padl",
798
+ "expected_value": "....pad-me",
799
+ "params": [
800
+ { "name": "value", "value": "pad-me" },
801
+ { "name": "count", "value": 10 },
802
+ { "name": "char", "value": "." }
803
+ ],
804
+ "template": "{{padl value count char}}"
805
+ },
806
+ {
807
+ "alias": "pad_left",
808
+ "expected_value": "....pad-me",
809
+ "params": [
810
+ { "name": "value", "value": "pad-me" },
811
+ { "name": "count", "value": 10 },
812
+ { "name": "char", "value": "." }
813
+ ],
814
+ "template": "{{pad_left value count char}}"
815
+ },
816
+ {
817
+ "alias": "rjust",
818
+ "expected_value": "....pad-me",
819
+ "params": [
820
+ { "name": "value", "value": "pad-me" },
821
+ { "name": "count", "value": 10 },
822
+ { "name": "char", "value": "." }
823
+ ],
824
+ "template": "{{rjust value count char}}"
825
+ }
826
+ ],
827
+ "aliases": ["padl", "pad_left", "rjust"],
828
+ "require_path": "handlebars/helpers/string_formatting/padl",
829
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Padl",
830
+ "is_string_formatter": null
831
+ },
832
+ {
833
+ "name": "prepend_if",
834
+ "description": "returns value with prefix if the value is present?",
835
+ "test_in": null,
836
+ "test_out": null,
837
+ "tests": [
838
+ {
839
+ "alias": "prepend_if",
840
+ "expected_value": "# product_categories",
841
+ "params": [
842
+ { "name": "value", "value": "product category" },
843
+ { "name": "prefix", "value": "# " },
844
+ { "name": "formats", "value": "pluralize,snake" }
845
+ ],
846
+ "template": "{{prepend_if value prefix formats}}"
847
+ },
848
+ {
849
+ "alias": "prefix_if",
850
+ "expected_value": "# product_categories",
851
+ "params": [
852
+ { "name": "value", "value": "product category" },
853
+ { "name": "prefix", "value": "# " },
854
+ { "name": "formats", "value": "pluralize,snake" }
855
+ ],
856
+ "template": "{{prefix_if value prefix formats}}"
857
+ }
858
+ ],
859
+ "aliases": ["prepend_if", "prefix_if"],
860
+ "require_path": "handlebars/helpers/string_formatting/prepend_if",
861
+ "class_namespace": "Handlebars::Helpers::StringFormatting::PrependIf",
862
+ "is_string_formatter": null
863
+ },
864
+ {
865
+ "name": "append_if",
866
+ "description": "returns value with suffix if the value is present?",
867
+ "test_in": null,
868
+ "test_out": null,
869
+ "tests": [
870
+ {
871
+ "alias": "append_if",
872
+ "expected_value": "product_categories:",
873
+ "params": [
874
+ { "name": "value", "value": "product category" },
875
+ { "name": "suffix", "value": ":" },
876
+ { "name": "formats", "value": "pluralize,snake" }
877
+ ],
878
+ "template": "{{append_if value suffix formats}}"
879
+ },
880
+ {
881
+ "alias": "suffix_if",
882
+ "expected_value": "product_categories:",
883
+ "params": [
884
+ { "name": "value", "value": "product category" },
885
+ { "name": "suffix", "value": ":" },
886
+ { "name": "formats", "value": "pluralize,snake" }
887
+ ],
888
+ "template": "{{suffix_if value suffix formats}}"
889
+ }
890
+ ],
891
+ "aliases": ["append_if", "suffix_if"],
892
+ "require_path": "handlebars/helpers/string_formatting/append_if",
893
+ "class_namespace": "Handlebars::Helpers::StringFormatting::AppendIf",
894
+ "is_string_formatter": null
895
+ },
896
+ {
897
+ "name": "surround_if",
898
+ "description": "returns value with surrounding prefix/suffix if the value is present?",
899
+ "test_in": null,
900
+ "test_out": null,
901
+ "tests": [
902
+ {
903
+ "alias": "surround_if",
904
+ "expected_value": "(product_categories)",
905
+ "params": [
906
+ { "name": "value", "value": "product category" },
907
+ { "name": "prefix", "value": "(" },
908
+ { "name": "suffix", "value": ")" },
909
+ { "name": "formats", "value": "pluralize,snake" }
910
+ ],
911
+ "template": "{{surround_if value prefix suffix formats}}"
912
+ },
913
+ {
914
+ "alias": "surround_if_value",
915
+ "expected_value": "(product_categories)",
916
+ "params": [
917
+ { "name": "value", "value": "product category" },
918
+ { "name": "prefix", "value": "(" },
919
+ { "name": "suffix", "value": ")" },
920
+ { "name": "formats", "value": "pluralize,snake" }
921
+ ],
922
+ "template": "{{surround_if_value value prefix suffix formats}}"
923
+ }
924
+ ],
925
+ "aliases": ["surround_if", "surround_if_value"],
926
+ "require_path": "handlebars/helpers/string_formatting/surround_if",
927
+ "class_namespace": "Handlebars::Helpers::StringFormatting::SurroundIf",
928
+ "is_string_formatter": null
929
+ },
930
+ {
931
+ "name": "surround",
932
+ "description": "returns value with surrounding prefix/suffix",
933
+ "test_in": null,
934
+ "test_out": null,
935
+ "tests": [
936
+ {
937
+ "alias": "surround",
938
+ "expected_value": "()",
939
+ "params": [
940
+ { "name": "value", "value": null },
941
+ { "name": "prefix", "value": "(" },
942
+ { "name": "suffix", "value": ")" },
943
+ { "name": "formats", "value": "" }
944
+ ],
945
+ "template": "{{surround value prefix suffix formats}}"
946
+ }
947
+ ],
948
+ "aliases": ["surround"],
949
+ "require_path": "handlebars/helpers/string_formatting/surround",
950
+ "class_namespace": "Handlebars::Helpers::StringFormatting::Surround",
951
+ "is_string_formatter": null
952
+ }
953
+ ]
954
+ }
955
+ ]
956
+ }