tzispa_rig 0.3.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: 708d90bb94a81f1397c06164861b26975526e3ef
4
- data.tar.gz: 57f5d6f6f9d76deac46e8290450d317f695c7746
3
+ metadata.gz: 1b1464a9fd319fa56702a54567f45ff6a0d00275
4
+ data.tar.gz: 969265c272c7eee232fcbfd4c5f224db95419362
5
5
  SHA512:
6
- metadata.gz: c141e157fb0cd26f877c63c9ad08558456e4186dabac95fa97beb947ed7cecbf7933c0645f2f13805265d15b8b236ec5b2e386b8ede161cb9afff78d96d6d542
7
- data.tar.gz: cc85b3bb9a08de8cc34397ce0bf138ed9e9e9339c9ec1676ecfc9a9a7e55b12876ecdb735bea5c97e8e677fd1d22fb9586fe840f9c59668455d3ea84efd5d3cc
6
+ metadata.gz: 2a4391839a2537d75c974374b292c4b952285f8c64ca0312f149d59a5a5e90c177a5a1e0d93fbf382c0b698998cf073007d54f4b47736b510b8b5cc4bb6d61f7
7
+ data.tar.gz: c5c030ed0ee930be9ddeadc8ad1613d6011d574041fbac399553ed12c8a2cba61410f8a2ef0c1786bcbff0bfee70875a2efd37aba01dd18d6fa7d14704b9898d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@ Tzispa Rig
2
2
 
3
3
  Rig templates implementation
4
4
 
5
+ ## 0.3.1
6
+ - Fix error in engine template cache that was losing template params when a template was recovered form cache
7
+
5
8
  ## 0.3.0
6
9
  - Separate engine class into independant ruby file
7
10
  - Move rig url builder tags into independant parser category
@@ -31,9 +31,13 @@ module Tzispa
31
31
 
32
32
  def rig_template(name, type, tpl_format, params, parent)
33
33
  if @cache
34
- @mutex.owned? ?
35
- cache_template(name, type, tpl_format, params, parent) :
36
- @mutex.synchronize { cache_template(name, type, tpl_format, params, parent) }
34
+ if @mutex.owned?
35
+ cache_template(name, type, tpl_format, parent, params)
36
+ else
37
+ @mutex.synchronize {
38
+ cache_template(name, type, tpl_format, parent, params)
39
+ }
40
+ end
37
41
  else
38
42
  Template.new(name: name, type: type, format: format, domain: @app.domain, params: params, parent: parent, engine: self).load!.parse!
39
43
  end
@@ -41,16 +45,19 @@ module Tzispa
41
45
 
42
46
  private
43
47
 
44
- def cache_template(name, type, tpl_format, params, parent)
48
+ def cache_template(name, type, tpl_format, parent, params)
45
49
  ktpl = "#{type}__#{name}".to_sym
46
50
  tpl = @cache.getset(ktpl) {
47
- Template.new(name: name, type: type, format: tpl_format, domain: @app.domain, params: params, parent: parent, engine: self).load!.parse!
51
+ Template.new(name: name, type: type, format: tpl_format, domain: @app.domain, parent: parent, engine: self).load!.parse!
48
52
  }
49
53
  if tpl.modified?
50
54
  @cache[ktpl] = tpl.load!.parse!
51
55
  else
52
56
  tpl
53
57
  end
58
+ tpl.dup.tap { |ctpl|
59
+ ctpl.params = params if params
60
+ }
54
61
  end
55
62
 
56
63
  end
@@ -15,7 +15,7 @@ module Tzispa
15
15
  :purl => /<purl:(\w+(?:\.\w+)?)(\[(\w+=[^,\]]+(,\w+=[^,\]]+)*?)\])?\/>/,
16
16
  :url => /<url:(\w+(?:\.\w+)?)(\[(\w+=[^,\]]+(,\w+=[^,\]]+)*?)\])?\/>/,
17
17
  :api => /<api:([^:\.]+(?:\.[^:]+)?):([^:\/]+)(?::([^:\/]+))?(?::([^\/]+))?\/>/
18
- }
18
+ }.freeze
19
19
 
20
20
  RIG_STATEMENTS = /(<(loop):(\w+)>(.*?)<\/loop:\3>)|(<(ife):(\w+)>(.*?)(<else:\7\/>(.*?))?<\/ife:\7>)/m
21
21
 
@@ -3,7 +3,7 @@
3
3
  module Tzispa
4
4
  module Rig
5
5
 
6
- VERSION = '0.3.0'
6
+ VERSION = '0.3.1'
7
7
  GEM_NAME = 'tzispa_rig'
8
8
 
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tzispa_rig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Antonio Piñero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-02 00:00:00.000000000 Z
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzispa_helpers