quintype-liquid 0.1.8 → 0.1.9

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
  SHA1:
3
- metadata.gz: 5fa585bcace1c1f54b2d48abd6a8fdb711af4a8f
4
- data.tar.gz: eb7cd2f248e6186325e8a31e1d052d7b7017a1f9
3
+ metadata.gz: ca07f164bf7d0109e6d9ddac83f962dfa5d207c3
4
+ data.tar.gz: 49396e0eef776757446101ab8b5814ffad3e4af3
5
5
  SHA512:
6
- metadata.gz: 814da9ac2e106f4682587b33038f55276bca6438d08c748c51f3a1208cd8b65a0383fc8a1b009e60229c8143356d6dac666fcdcf7c4d751c186828003bd3bbc3
7
- data.tar.gz: 973115db1dd6179452d85f91f1bac6e974190dda00d4d43dae6c05073b3c7faddd29749f2fd5468ac40e6dd9534b33384916b1d06656434383527b3634e6e080
6
+ metadata.gz: 56fb3890bde285795182526bc182b59cdf7bd4b62ed097335b5678ff05a3cb58f67d4d3f84a9f781856f9a25e4f17c6bd372e30062c66f260049c9502f96a815
7
+ data.tar.gz: 92d421cd0b4884cc0f333749622d13a57213001720675ffeb9a6b848bd3cd0d6fdd70cf7861fda9d294844115019deb68ff6e6ba19df2f9213f9d8adc270c7a8
@@ -1,8 +1,14 @@
1
1
  module Quintype::Liquid
2
2
  module LiquidTemplateCachingModule
3
- CACHED_TEMPLATES = Concurrent::Map.new do |m, template|
4
- Rails.logger.info "Compiling Template"
5
- m[template] = ::Liquid::Template.parse(template)
3
+
4
+ QUINTPYE_LIQUID_KEY = :quintype_liquid_template_cache
5
+
6
+ def compiled_template(template)
7
+ Thread.current[QUINTPYE_LIQUID_KEY] ||= Hash.new do |m, template|
8
+ Rails.logger.info "Compiling Template"
9
+ m[template] = ::Liquid::Template.parse(template)
10
+ end
11
+ Thread.current[QUINTPYE_LIQUID_KEY][template]
6
12
  end
7
13
 
8
14
  def render(template, local_assigns = {})
@@ -16,7 +22,7 @@ module Quintype::Liquid
16
22
  assigns['content_for_layout'] = @view.content_for(:layout) if @view.content_for?(:layout)
17
23
  assigns.merge!(local_assigns.stringify_keys)
18
24
 
19
- liquid = LiquidTemplateCachingModule::CACHED_TEMPLATES[template]
25
+ liquid = compiled_template(template)
20
26
  liquid.send(:render!, assigns, filters: filters, registers: { view: @view, controller: @controller, helper: @helper }).html_safe
21
27
  end
22
28
  end
@@ -1,5 +1,5 @@
1
1
  module Quintype
2
2
  module Liquid
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quintype-liquid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tejas Dinkar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-31 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid-rails
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.2.2
110
+ rubygems_version: 2.5.1
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Isomorphically Render Liquid in Rails and JS