smolbars 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c86063c597fa360633865862f4b842436d6d5489b84cc9d1f9510e20dbf28dd
4
- data.tar.gz: ff87fb9498227b9f241784568aaf179e0e4830dc0493021ea3cb07ef1339695a
3
+ metadata.gz: f624459b6448042adad2e8b0adb09948f23de085136137624b15925b926b14e0
4
+ data.tar.gz: 0bd1001f25af33c61959e74ead28bb19bd3e3794c4d0809d0906903ac29567b0
5
5
  SHA512:
6
- metadata.gz: df4fbdf91b1fe83b5b09882265d4d6674d9f32c9099aa5f5fea0ae176d001ca772ccb23784ea0d86949d0b91e24a7fc60f58bd1c1a21820b7b59701bdf3628ca
7
- data.tar.gz: 8460b1163060ce6759b643213e84b4a09f3f262ce3d53cfc0adc336243038ae052f53b9fcd931f004c4b8ad579065fd1c9def115d25db2708e5a602206978416
6
+ metadata.gz: efe29c440d8a973c2b9b482e443b7fc9fcf1615913aaed974606b24e6b53ba1c3eb788c8df22ae1313ee7958c700008754c1fd7615d3d4a64494a624f730774d
7
+ data.tar.gz: 5c6e1be44b56bee693438230f4a07bb1808749dcd6589599c95336164ab9c5b33a55d5e022b44b14dcda85a227acaae7c186145d3d2e1b46460c64d2be75dea2
@@ -5,8 +5,8 @@ require 'securerandom'
5
5
  module Smolbars
6
6
  class Context
7
7
  def initialize(**kwargs)
8
- @js = MiniRacer::Context.new(kwargs)
9
- @js.load(Handlebars::Source.bundled_path)
8
+ @@snapshot ||= MiniRacer::Snapshot.new(File.read(Handlebars::Source.bundled_path))
9
+ @js = MiniRacer::Context.new(kwargs.merge(snapshot: @@snapshot))
10
10
  end
11
11
 
12
12
  # Note that this is a hacky JS expression builder. We cannot pass JS AST in to mini_racer so we have to
@@ -8,8 +8,7 @@ module Smolbars
8
8
  if args.length == 0
9
9
  invocation = "%s(%s)" % [@fn, kwargs.to_json]
10
10
  else
11
- raise "unsupported"
12
- invocation = "%s(%s)" % [@fn, args.to_json]
11
+ invocation = "%s(%s)" % [@fn, args.first.to_json]
13
12
  end
14
13
  @context.eval(invocation)
15
14
  end
@@ -1,3 +1,3 @@
1
1
  module Smolbars
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smolbars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Lowell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-02-15 00:00:00.000000000 Z
12
+ date: 2022-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mini_racer
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubygems_version: 3.2.23
101
+ rubygems_version: 3.3.7
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Ruby bindings for the smolbars.js templating library