handlebarsjs 0.9.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58a93fc0ff8ee926166b36c99e17e122d5a021a47baeb8333723d92a14afdbf8
4
- data.tar.gz: 5f63d1066db8a9d0163b46b43a54ac59536d3e06e2bd2297cf53291c01d69a1b
3
+ metadata.gz: b21553bd71f98ce385d2087daa032891f2b41a0b356ef9db51cc42593a3cca4d
4
+ data.tar.gz: 88b131f23ead9f59fde8a429649162ebb295beecb9889933da14782e8750ec4f
5
5
  SHA512:
6
- metadata.gz: 32659c1788e4a22ce665315bfcf893333d3fa07510eda438d8bba3c007acf3501ab08dfe73d153517c2e2515b5eefa398a16551d5eccc60e69654a970c7d0951
7
- data.tar.gz: 8ffda416eda0a82362b6cac19ca52a2260aa768d62bb9926b8ca0abd54d81e42acf18b6780a122141abd0c68a1559e770d3e558b7c89ab8c2025ea0464a50d7f
6
+ metadata.gz: 8927454f7581a0665d05987ce606c2916754c24700af611d817c17a806919c05e0309d4c0a0c0d5e5b2a182896e021cd75659ab84d94dc8f27e1ac3f1d83028e
7
+ data.tar.gz: f0b6ee9e3fa976ffa58778c912938088bdc750fd602eb7b775db60a15bb1a02ffa9c0bf78f6cd46a142ec75e7fc292feeb4fa3fa951421d915d486b235e95bb9
data/.rubocop.yml CHANGED
@@ -15,7 +15,7 @@ Metrics/BlockLength:
15
15
  Exclude:
16
16
  - "**/spec/**/*"
17
17
  - "*.gemspec"
18
- IgnoredMethods:
18
+ AllowedMethods:
19
19
  - configure
20
20
  - context
21
21
  - define
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [0.10.0](https://github.com/klueless-io/handlebarsjs/compare/v0.9.0...v0.10.0) (2022-08-24)
2
+
3
+
4
+ ### Features
5
+
6
+ * add str: :padl and str: padr ([2d56458](https://github.com/klueless-io/handlebarsjs/commit/2d5645812de730c8d9ee96cb8509fa9b8f5399d2))
7
+
8
+ # [0.9.0](https://github.com/klueless-io/handlebarsjs/compare/v0.8.0...v0.9.0) (2022-07-16)
9
+
10
+
11
+ ### Features
12
+
13
+ * add safe support ([edc7062](https://github.com/klueless-io/handlebarsjs/commit/edc70623130ca6ae397b3532e4609ffd825cd7a3))
14
+
1
15
  # [0.8.0](https://github.com/klueless-io/handlebarsjs/compare/v0.7.0...v0.8.0) (2022-07-16)
2
16
 
3
17
 
data/lib/_.rb CHANGED
@@ -31,4 +31,7 @@ require_relative 'handlebarsjs/helpers/inflection/pluralize'
31
31
  require_relative 'handlebarsjs/helpers/inflection/pluralize_number'
32
32
  require_relative 'handlebarsjs/helpers/inflection/pluralize_number_word'
33
33
  require_relative 'handlebarsjs/helpers/inflection/singularize'
34
+ require_relative 'handlebarsjs/helpers/misc/format_json'
34
35
  require_relative 'handlebarsjs/helpers/misc/safe'
36
+ require_relative 'handlebarsjs/helpers/str/padl'
37
+ require_relative 'handlebarsjs/helpers/str/padr'
@@ -9,6 +9,7 @@ module Handlebarsjs
9
9
  add_comparison_defaults
10
10
  add_inflection_defaults
11
11
  add_misc_defaults
12
+ add_str_defaults
12
13
  end
13
14
 
14
15
  def add_array_defaults
@@ -64,8 +65,16 @@ module Handlebarsjs
64
65
 
65
66
  def add_misc_defaults
66
67
  KConfig.configure do |config|
68
+ config.handlebars.helper(:format_json, Handlebarsjs::Helpers::Misc::FormatJson.new)
67
69
  config.handlebars.helper(:safe, Handlebarsjs::Helpers::Misc::Safe.new)
68
70
  end
69
71
  end
72
+
73
+ def add_str_defaults
74
+ KConfig.configure do |config|
75
+ config.handlebars.helper(:padl, Handlebarsjs::Helpers::Str::Padl.new)
76
+ config.handlebars.helper(:padr, Handlebarsjs::Helpers::Str::Padr.new)
77
+ end
78
+ end
70
79
  end
71
80
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handlebarsjs
4
+ module Helpers
5
+ # Miscellaneous cmdlets
6
+ module Misc
7
+ # FormatJson: FormatJson will take an object and write it out as pretty JSON
8
+ class FormatJson < Handlebarsjs::BaseHelper
9
+ register_cmdlet(Cmdlet::Misc::FormatJson)
10
+
11
+ def to_proc
12
+ ->(value, _opts) { wrapper(cmdlet.call(value)) }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handlebarsjs
4
+ module Helpers
5
+ # String manipulation
6
+ module Str
7
+ # Padl: take the value and give it padding on the left hand side
8
+ class Padl < Handlebarsjs::BaseHelper
9
+ register_cmdlet(Cmdlet::Str::Padl)
10
+
11
+ def to_proc
12
+ ->(value, count = nil, char = nil, _opts) { wrapper(cmdlet.call(value, count, char)) }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handlebarsjs
4
+ module Helpers
5
+ # String manipulation
6
+ module Str
7
+ # Padr: take the value and give it padding on the right hand side
8
+ class Padr < Handlebarsjs::BaseHelper
9
+ register_cmdlet(Cmdlet::Str::Padr)
10
+
11
+ def to_proc
12
+ ->(value, count = nil, char = nil, _opts) { cmdlet.call(value, count, char) }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Handlebarsjs
4
- VERSION = '0.9.0'
4
+ VERSION = '0.11.0'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "handlebarsjs",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "handlebarsjs",
9
- "version": "0.9.0",
9
+ "version": "0.11.0",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.1",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handlebarsjs",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "handlebarsjs GEM wraps the handlebars.js library and provides ruby/javascript interoperability",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handlebarsjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-16 00:00:00.000000000 Z
11
+ date: 2023-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cmdlet
@@ -69,7 +69,6 @@ files:
69
69
  - ".builders/director/handlebars_helper_director.rb"
70
70
  - ".builders/generators/01-bootstrap.rb"
71
71
  - ".builders/generators/domain_model.rb"
72
- - ".builders/generators/helpers/comparison_helpers.rb"
73
72
  - ".builders/generators/project-plan.rb"
74
73
  - ".releaserc.json"
75
74
  - ".rspec"
@@ -128,7 +127,10 @@ files:
128
127
  - lib/handlebarsjs/helpers/inflection/pluralize_number.rb
129
128
  - lib/handlebarsjs/helpers/inflection/pluralize_number_word.rb
130
129
  - lib/handlebarsjs/helpers/inflection/singularize.rb
130
+ - lib/handlebarsjs/helpers/misc/format_json.rb
131
131
  - lib/handlebarsjs/helpers/misc/safe.rb
132
+ - lib/handlebarsjs/helpers/str/padl.rb
133
+ - lib/handlebarsjs/helpers/str/padr.rb
132
134
  - lib/handlebarsjs/javascript.rb
133
135
  - lib/handlebarsjs/javascript/handlebars-4.7.7.js
134
136
  - lib/handlebarsjs/javascript/handlebars-api.js
@@ -160,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
162
  - !ruby/object:Gem::Version
161
163
  version: '0'
162
164
  requirements: []
163
- rubygems_version: 3.1.2
165
+ rubygems_version: 3.3.5
164
166
  signing_key:
165
167
  specification_version: 4
166
168
  summary: handlebarsjs GEM wraps the handlebars.js library and provides ruby/javascript
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # base_class_require 'handlebars/helpers/comparison/base_helper'
4
- # base_class 'Handlebars::Helpers::Comparison::BaseHelper'
5
- # example_input_value 'var1 and var2'
6
- # example_output_value 'truthy block'
7
- # test_input_value 'var1 and var2'
8
- # test_output_value 'truthy block'
9
-
10
- KManager.action :comparison_helpers do
11
- action do
12
- common = OpenStruct.new(
13
- category_name: 'comparison',
14
- category_description: 'Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.'
15
- )
16
-
17
- HandlebarsHelperDirector
18
- .init(k_builder, on_exist: :write, on_action: :execute)
19
- .helper do
20
- category common.category_name
21
- category_description common.category_description
22
- name 'and'
23
- description 'And: Block helper that renders a block if **all of** the given values are truthy. If an inverse block is specified it will be rendered when falsy.'
24
- result "return block when every value is truthy"
25
- parameter('values', 'list of values (via *splat) to be checked via AND condition', splat: true)
26
-
27
- example <<-TEXT
28
- {{#if (and p1 p2 p3 p4 p5)}}
29
- found
30
- {{/if}}
31
- TEXT
32
-
33
- example <<-TEXT
34
- {{#if (and name age)}}
35
- {{name}}-{{age}}
36
- {{else}}
37
- no name or age
38
- {{/if}}
39
- TEXT
40
- end
41
- .build_helpers
42
- .debug
43
- end
44
- end