handlebarsjs 0.5.6 → 0.5.7

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: 6064a3ae1b125ad1e3e15b35845d7ad996d6b1742e0aacf4bcee1a8d828a2572
4
- data.tar.gz: 926bd6bb058fc865acd74b2af72678858247b494190c6a3cb6bf2b9a66465084
3
+ metadata.gz: 11fa1ae2d5651494b88fba96cffddf5fbf61a4a4bca2d558af4bf4c9bdab7051
4
+ data.tar.gz: ba0da5f90e25cb0d9aa93d3b0da33c1a7bd46051d194f37a6423831cad83e39b
5
5
  SHA512:
6
- metadata.gz: 80dfd3854cdf31fb1a068a3c8713dacc85791e7280b7160f30a8a245ed070487a397e838373b356db791b79a64aa6c07b27e091c1061b51cc1dc358c6305bf45
7
- data.tar.gz: c29fb792acbe8649679d26879670a9e3742330715146968e001a66814ee3b730e33757b16751b47ca0a1a094b2525a1bdd3f193c17f22e544bf69741abcce432
6
+ metadata.gz: 9c56cb2167139c856225497aa504d8bd4c3352b262427eeb812491a9dbe67d7a334c7034b48e16d55e7c455adff584e978894812971e75379e964fbc37880ad6
7
+ data.tar.gz: e3534532930b1ed409d34c8ab48444c7313016c01d928043650d2c84e5203ff34a5a7ada22ea2bf15c9525ca931c35712f31d331bf90af2758eef99dfb08f826
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.5.6](https://github.com/klueless-io/handlebarsjs/compare/v0.5.5...v0.5.6) (2022-07-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add configuration capability to handlebars_snapshot ([06f7ca6](https://github.com/klueless-io/handlebarsjs/commit/06f7ca628018d4a89c9b068c8cae4565a624a3db))
7
+
1
8
  ## [0.5.5](https://github.com/klueless-io/handlebarsjs/compare/v0.5.4...v0.5.5) (2022-07-12)
2
9
 
3
10
 
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ KConfig.configure do |config|
4
+ config.handlebars.helper(:join, Handlebarsjs::Helpers::Array::Join.new)
5
+ config.handlebars.helper(:join_pre, Handlebarsjs::Helpers::Array::JoinPre.new)
6
+ config.handlebars.helper(:join_post, Handlebarsjs::Helpers::Array::JoinPost.new)
7
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ KConfig.configure do |config|
4
+ config.handlebars.helper(:back_slash, Handlebarsjs::Helpers::Case::BackSlash.new)
5
+ config.handlebars.helper(:camel, Handlebarsjs::Helpers::Case::Camel.new)
6
+ config.handlebars.helper(:constant, Handlebarsjs::Helpers::Case::Constant.new)
7
+ config.handlebars.helper(:dash, Handlebarsjs::Helpers::Case::Dash.new)
8
+ config.handlebars.helper(:dot, Handlebarsjs::Helpers::Case::Dot.new)
9
+ config.handlebars.helper(:double_colon, Handlebarsjs::Helpers::Case::DoubleColon.new)
10
+ config.handlebars.helper(:human, Handlebarsjs::Helpers::Case::Human.new)
11
+ config.handlebars.helper(:lamel, Handlebarsjs::Helpers::Case::Lamel.new)
12
+ config.handlebars.helper(:lower, Handlebarsjs::Helpers::Case::Lower.new)
13
+ config.handlebars.helper(:slash, Handlebarsjs::Helpers::Case::Slash.new)
14
+ config.handlebars.helper(:snake, Handlebarsjs::Helpers::Case::Snake.new)
15
+ config.handlebars.helper(:title, Handlebarsjs::Helpers::Case::Title.new)
16
+ config.handlebars.helper(:upper, Handlebarsjs::Helpers::Case::Upper.new)
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ KConfig.configure do |config|
4
+ config.handlebars.helper(:and, Handlebarsjs::Helpers::Comparison::And.new)
5
+ config.handlebars.helper(:default, Handlebarsjs::Helpers::Comparison::Default.new)
6
+ config.handlebars.helper(:eq, Handlebarsjs::Helpers::Comparison::Eq.new)
7
+ config.handlebars.helper(:gt, Handlebarsjs::Helpers::Comparison::Gt.new)
8
+ config.handlebars.helper(:gte, Handlebarsjs::Helpers::Comparison::Gte.new)
9
+ config.handlebars.helper(:lt, Handlebarsjs::Helpers::Comparison::Lt.new)
10
+ config.handlebars.helper(:lte, Handlebarsjs::Helpers::Comparison::Lte.new)
11
+ config.handlebars.helper(:ne, Handlebarsjs::Helpers::Comparison::Ne.new)
12
+ config.handlebars.helper(:or, Handlebarsjs::Helpers::Comparison::Or.new)
13
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ KConfig.configure do |config|
4
+ config.handlebars.helper(:ordinal, Handlebarsjs::Helpers::Inflection::Ordinal.new)
5
+ config.handlebars.helper(:ordinalize, Handlebarsjs::Helpers::Inflection::Ordinalize.new)
6
+ config.handlebars.helper(:pluralize, Handlebarsjs::Helpers::Inflection::Pluralize.new)
7
+ config.handlebars.helper(:pluralize_number, Handlebarsjs::Helpers::Inflection::PluralizeNumber.new)
8
+ config.handlebars.helper(:pluralize_number_word, Handlebarsjs::Helpers::Inflection::PluralizeNumberWord.new)
9
+ config.handlebars.helper(:singularize, Handlebarsjs::Helpers::Inflection::Singularize.new)
10
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Handlebarsjs
4
- VERSION = '0.5.6'
4
+ VERSION = '0.5.7'
5
5
  end
data/lib/handlebarsjs.rb CHANGED
@@ -10,6 +10,7 @@ require_relative 'handlebarsjs/handlebars'
10
10
  require_relative 'handlebarsjs/base_helper'
11
11
  require_relative '_'
12
12
 
13
+ # Handlebarsjs is a Ruby wrapper for the Handlebars.js templating engine.
13
14
  module Handlebarsjs
14
15
  HANDLEBARS_LIBRARY_PATH = 'lib/handlebarsjs/javascript/handlebars-4.7.7.js'
15
16
  HANDLEBARS_API_PATH = 'lib/handlebarsjs/javascript/handlebars-api.js'
@@ -17,7 +18,27 @@ module Handlebarsjs
17
18
  # raise Handlebarsjs::Error, 'Sample message'
18
19
  Error = Class.new(StandardError)
19
20
 
20
- # Your code goes here...
21
+ class << self
22
+ # Get a singleton instance of the Handlebars engine.
23
+ #
24
+ # The engine is exposed as a singleton and that means that if you
25
+ # alter the configuration after calling Handlebarsjs.engine,
26
+ # you will have old helper state attached to the engine.
27
+ #
28
+ # If you need to update your helper state, then run Handlebarsjs.reset
29
+ # to clear the singleton
30
+ def engine
31
+ @engine ||= Handlebarsjs::Handlebars.new
32
+ end
33
+
34
+ def reset
35
+ @engine = nil
36
+ end
37
+
38
+ def process_template(template, options = {})
39
+ @engine.process_template(template, options)
40
+ end
41
+ end
21
42
  end
22
43
 
23
44
  if ENV.fetch('KLUE_DEBUG', 'false').downcase == 'true'
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "handlebarsjs",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "handlebarsjs",
9
- "version": "0.5.6",
9
+ "version": "0.5.7",
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.5.6",
3
+ "version": "0.5.7",
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handlebarsjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -95,6 +95,7 @@ files:
95
95
  - lib/handlebarsjs/configuration.rb
96
96
  - lib/handlebarsjs/handlebars.rb
97
97
  - lib/handlebarsjs/handlebars_snapshot.rb
98
+ - lib/handlebarsjs/helpers/array/default_configuration.rb
98
99
  - lib/handlebarsjs/helpers/array/join.rb
99
100
  - lib/handlebarsjs/helpers/array/join_post.rb
100
101
  - lib/handlebarsjs/helpers/array/join_pre.rb
@@ -102,6 +103,7 @@ files:
102
103
  - lib/handlebarsjs/helpers/case/camel.rb
103
104
  - lib/handlebarsjs/helpers/case/constant.rb
104
105
  - lib/handlebarsjs/helpers/case/dash.rb
106
+ - lib/handlebarsjs/helpers/case/default_configuration.rb
105
107
  - lib/handlebarsjs/helpers/case/dot.rb
106
108
  - lib/handlebarsjs/helpers/case/double_colon.rb
107
109
  - lib/handlebarsjs/helpers/case/human.rb
@@ -113,6 +115,7 @@ files:
113
115
  - lib/handlebarsjs/helpers/case/upper.rb
114
116
  - lib/handlebarsjs/helpers/comparison/and.rb
115
117
  - lib/handlebarsjs/helpers/comparison/default.rb
118
+ - lib/handlebarsjs/helpers/comparison/default_configuration.rb
116
119
  - lib/handlebarsjs/helpers/comparison/eq.rb
117
120
  - lib/handlebarsjs/helpers/comparison/gt.rb
118
121
  - lib/handlebarsjs/helpers/comparison/gte.rb
@@ -120,6 +123,7 @@ files:
120
123
  - lib/handlebarsjs/helpers/comparison/lte.rb
121
124
  - lib/handlebarsjs/helpers/comparison/ne.rb
122
125
  - lib/handlebarsjs/helpers/comparison/or.rb
126
+ - lib/handlebarsjs/helpers/inflection/default_configuration.rb
123
127
  - lib/handlebarsjs/helpers/inflection/ordinal.rb
124
128
  - lib/handlebarsjs/helpers/inflection/ordinalize.rb
125
129
  - lib/handlebarsjs/helpers/inflection/pluralize.rb